| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Adding a page with my own PHP Code | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Adding a page with my own PHP Code
Hi,
I just started using X-Cart a few days ago. So far so good for the most part. I currently have a site which sells just one product. (http://www.taxiguitarproducts.com) I'm adding some more products so I'm setting up a cart. A feature on the current site is a side bar element that displays guitarist's birthdays from a database I compiled. I'd like to add this as a page on my x-cart site. I've added a menu item and a page, but I don't see an obvious way to add the code that works. Can this be done? is there some special markup that need to be included? It's pretty straight forward stuff. It's only about 100 lines of code. I thank you in advance for your help. Nick Paonessa
__________________
Nick Paonessa BlackFive Media Inc. |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Adding a page with my own PHP Code
Well, you need to include your PHP script. Finding a good place to put your include can be a challenge.
It sounds like you are using a static page, perhaps pages.php would be a good place to place your include. Then in your php file, you need to assign the array or variable that you want to reference to smarty, the template engine. Code:
Then you can reference it in you page, assuming that you have checked the box to "Parse Smarty tags in the content of embedded pages" in the pages section of the admin. Then you can build a foreach loop to loop through your array. Code:
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
#3
|
|||||||
|
|||||||
Re: Adding a page with my own PHP Code
Thank you for your reply TotalTec. I could not get your solutions to work, but I thank you for your suggestion. I learned a couple of things in trying to implement it and your suggestion did lead me to a solution.
I think I found a way around it. I created a separate page on my server with just the PHP in it. (guitarists-bday.php) Then in the empty X-Cart page, I referenced that page in an iframe tag. <p><iframe src="/guitarists-bday.php" width="500" height="500" frameborder="0" scrolling="no"> </iframe></p> It's not elegant but it works. Thanks again. Nick Paonessa
__________________
Nick Paonessa BlackFive Media Inc. |
|||||||
#4
|
|||||||||
|
|||||||||
Re: Adding a page with my own PHP Code
Nick, sure an Iframe can work for anything.
What problems did you have exactly? Including your file? Assigning the variables to smarty? Rendering the html in your static page?
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
|
|||
X-Cart forums © 2001-2020
|