Summary of common problems in PHPCMS V9 development and application

Source: Internet
Author: User
Tags php file

The document list page does not contain uploaded articles.

The code is as follows: Copy code

Content action = "lists" catid = "$ catid" num = "7" order = "listorder DESC" thumb = "1" moreinfo = "1 "}

The default background code thumb = "1 & Prime;, but if there is no thumbnail, if the list is added with an image loop, the content will not be cyclically generated, therefore, thumb = "$ thumb" should be changed ".

The code is as follows: Copy code


{Php list ($ copyfrom) = explode ('|', $ r ['copyfrom'])}
{Php $ db = pc_base: load_model ('hits _ Model'); $ _ r = $ db-> get_one (array ('hitsid '=> 'C -'. $ modelid. '-'. $ r [id]); $ views =$ _ r [views];}

Add these two lines to output the source and number of clicks on the list page.

The image watermark switch of the Baidu editor integrated with PHPCMS V9 is invalid. If the watermark function is enabled for the site, all the images copied to the editor are forcibly watermark (no solution is available)

Pagination style customization
When you create a website, you may have to control the page style according to the template requirements. At this time, many people will modify the global file phpcmslibsfunctionsglobal. func. the pages () function in php has the following problem: This paging function will affect the background, that is, this paging function is shared across the site.
The solution is as follows: (You have to modify the file and remember to back up the file before modification)
Open
In the phpcmslibsfunctionsglobal. func. php file, find the paging function, copy it, paste it under the default paging function, and rename it. For example, my name is wz_pages and save it.

Open

The code is as follows: Copy code
Phpcms/libs/classes/template_cache.class.php, find
$ Str. = '$ pages = pages ($'. $ op. '_ total, $ page, $ pagesize, $ urlrule );';
Add
$ Str. = '$ wz_pages = wz_pages ($'. $ op. '_ total, $ page, $ pagesize, $ urlrule );';

Save.

Finally, if you want to use your custom paging function, you can directly use {$ wz_pages} in the template ,,

Modify the style later.
The wz_pages function in the phpcmslibsfunctionsglobal. func. php file does not affect the background.

I only have the ability to express myself. I can't understand it ,,

Subsequent optimization:

When using SQL pagination, you must add the following code:

Open

The code is as follows: Copy code
Phpcms/libs/classes/template_cache.class.php, find
$ Str. = '$ r = $ get_db-> SQL _query ('. $ SQL. '"); $ s = $ get_db-> fetch_next (); $ pages = pages ($ s ['count'], $ page, $ pagesize, $ urlrule );';
Add below him:
$ Str. = '$ r = $ get_db-> SQL _query ('. $ SQL. '"); $ s = $ get_db-> fetch_next (); $ wz_pages = wz_pages ($ s ['count'], $ page, $ pagesize, $ urlrule );';

In this way, the SQL page is normal, and Hey, you are welcome to make a brick, don't beat, you have to top Ah ~~

Subsequent optimization:

Some friends mentioned that the above method cannot be used in the Member Center's favorite list page.
Because the paging function of the favorite list is directly set in other files, it is not feasible to modify the template cache file.
The following is a solution:
Specifically
Phpcmslibsclassesmodel. class. php 61 rows

The code is as follows: Copy code
$ This-> pages = pages ($ this-> number, $ page, $ pagesize, $ urlrule, $ array, $ setpages );
Modify the above line:
$ This-> pages = wz_pages ($ this-> number, $ page, $ pagesize, $ urlrule, $ array, $ setpages );
(You do not need to change {$ wz_pages} in the template to {$ pages })

The above is the first method.
However, in this case, the background may also be affected. This place seems to be under control of many places.
You can also modify the file in this way. Do not modify the file in 61 lines. Add the following directly in line 61:

The code is as follows: Copy code
$ This-> wz_pages = wz_pages ($ this-> number, $ page, $ pagesize, $ urlrule, $ array, $ setpages );
Go to phpcmsmodulesmemberindex. php row 718.
Set $ pages = $ this-> favorite_db-> pages;
To:
$ Wz_pages = $ this-> favorite_db-> wz_pages;

Modify {$ pages} in the template to {$ wz_pages}

This is an example of adding a list to the favorites list ,,

 

Image upload problems
80% indicates that the path has been modified. If the default site path is modified, 80%, JavaScript becomes invalid or the upload folder permission is insufficient. Therefore, it is best to use the new site for development to facilitate path modification to transfer files to the server. The caches/system. php app_path path may be the problem.

Example

The image's js, images, and css paths are transferred to CDN, and the APP_PATH path is correct. The system prompts "server security authentication error" when uploading attachments. Find the phpcms/modules/attachment/functions/global. func. php file. The initupload function contains the following lines:

The code is as follows: Copy code
Swfu = new SWFUpload ({flash_url: "'. FLASH_UP_PATH.' swfupload/swfupload.swf ?" + Math. random (), upload_url: "'. APP_PATH.' index. php? M = attachment & c = attachments & a = swfupload & dosubmit = 1 & Prime;, file_post_name: "Filedata", where FLASH_UP_PATH is originally JS_PATH. the new defined constant in php: define ('flash _ UP_PATH ', APP_PATH. 'statics/js /');

Here, the path of the referenced Upload component is written to death. If JS_PATH is changed, this will definitely be affected. APP_PATH can be seen in the next line, this is why many answers have said that APP_PATH must be consistent with js, images, and css paths. The advantage of this solution is that the uploaded js component references this site, other js files can be stored anywhere. (Change APP_PATH to a fixed site directory to solve the problem temporarily)
 

Workflow modification (audit function)
When setting a workflow, modify the settings of the topic of the workflow to be used at the same time. Otherwise, you will be very depressed.

Introduction to cropping uploaded images

 

Click OK.
Upload topic articles

Go to the background code technology in the topic article list and check the previous topic source code.

About the full-site search module of PHPCMS v9

The default search code is classified search. To change it to full-site search, you can view the source code on the server.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.