| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Adding a new page that contains a php code? | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() The knowledge base has this page explaining how to add new page.
It works fine if I only put html contents in the page, but would there be any way to put php code in the new page? For example, if I put Code:
the same code in the viewer, at the end of the file, gives what I expect. However, if I put Code:
__________________
X-cart 5.2.12, php 5.6 Ed from Grenoble, France |
|||||||
#2
|
|||||||||
|
|||||||||
![]() All php code goes to classes files. You can't put any of it in the templates. If you need something on the page to show dynamically you have to make a call to the class file from the template which will return whatever you need to show.
There are other examples in the KB to show you how to do this
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#3
|
|||||||
|
|||||||
![]() Thank you for pointing me to KB examples. I tried to follow http://kb.x-cart.com/display/XDD/Working+with+viewer+classes and it goes fine if I add
Code:
Code:
__________________
X-cart 5.2.12, php 5.6 Ed from Grenoble, France |
|||||||
#4
|
|||||||||
|
|||||||||
![]() The above change should not cause any errors. Please check the syntax (you might miss a letter) and make sure that quotes are " and ' (sometimes when you copy the source code from a website quotes become wrong characters).
Do you see any error messages in log files that are located in the var/log/ directory?
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful ![]() Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
#5
|
|||||||
|
|||||||
![]() Oh, thank you very much. According to php_errors.log, I must have put
'' '' (twice single quotes) instead of " " (once double quotes) ![]() Next time, I will check log files before posting here asking for answer, promised.
__________________
X-cart 5.2.12, php 5.6 Ed from Grenoble, France |
|||||||
|
|
|||
X-Cart forums © 2001-2020
|