-=LRK=- Posted October 19, 2008 Posted October 19, 2008 Instead of entering in a static description for an item, I would like to have the OSCommerce description point to a separate HTML file, and read the Item Description from there. The theory is that when a customer clicks on "Item10", the description looks for the separate HTML document named "Item10.html" and then reads it from there to display like normal. So if I have 100 items, I would have 100 HTML documents. This way I can either modify each item separately, or I can have them all tied into a Master Template, where I can later change the layout, and it would then propagate to the child HTML documents. It's more work on the front end, but later changes would be very easy. Anybody care to take a stab at how to do this? Basically, I need to fill the Description with the proper code to pull more code from another document.
germ Posted October 19, 2008 Posted October 19, 2008 This thread may give some direction: Click Me You'd want to put something like this in your product description (I think): <?php include('desc0001.htm'); ?> Which would be the HTML description file. A word of caution: using eval() like that can leave you vulnerable to hackers.... :o If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
-=LRK=- Posted October 20, 2008 Author Posted October 20, 2008 Thank you. You are in the correct ballpark. I can see that this would be what I needed. However, it gave me the following error messages: Warning: include() [function.include]: URL file-access is disabled in the server configuration in D:\Servers\WebSites\Portable-Fun\product_info.php(142) : eval()'d code on line 1 Warning: include(http://portable-fun.com/descriptions/2630.html) [function.include]: failed to open stream: no suitable wrapper could be found in D:\Servers\WebSites\Portable-Fun\product_info.php(142) : eval()'d code on line 1 Warning: include() [function.include]: Failed opening 'http://portable-fun.com/descriptions/2630.html' for inclusion (include_path='.;D:\Servers\xampp\php\pear\') in D:\Servers\WebSites\Portable-Fun\product_info.php(142) : eval()'d code on line 1
germ Posted October 20, 2008 Posted October 20, 2008 Don't use a URL for the include - just a path. :huh: If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
-=LRK=- Posted October 20, 2008 Author Posted October 20, 2008 I then changed the Long Pathname to a ../PathName and I got a shorter error message, that is no longer looking for a wrapper: Warning: include(../descriptions/2630.html) [function.include]: failed to open stream: No such file or directory in D:\Servers\WebSites\Portable-Fun\product_info.php(142) : eval()'d code on line 1 Warning: include() [function.include]: Failed opening '../descriptions/2630.html' for inclusion (include_path='.;D:\Servers\xampp\php\pear\') in D:\Servers\WebSites\Portable-Fun\product_info.php(142) : eval()'d code on line 1
germ Posted October 20, 2008 Posted October 20, 2008 Then you must have the wrong path. I've really not done this. I just pointed you to some people who said it works. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
-=LRK=- Posted October 20, 2008 Author Posted October 20, 2008 GOT IT! Thanks for your help. With the path being Store/descriptions/2630.html I needed to put: Item Description: <?php include('descriptions/2630.html'); ?> Change product_info.php: <p><?php echo stripslashes($product_info['products_description']); ?></p> to: <?php eval (' ?> ' . $product_info['products_description'] . ' <?php '); ?>
germ Posted October 20, 2008 Posted October 20, 2008 And thank you for posting your success. I'm sure someone down the road will be blessed by your willingness to share your success. :) If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
Recommended Posts
Archived
This topic is now archived and is closed to further replies.