Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Insert a php tag into products description?


5 replies to this topic

#1 Top_Speed

  • Community Member
  • 357 posts
  • Real Name:KJ Miller
  • Location:SU-ville (Syracuse)

Posted 05 June 2008, 15:29

Hi all,

Searched and didn't come across this?

In the Products Description I want to put a php tag in like:
<?php include(DIR_WS_MODULES . 'xyz_warranty.php'); ?>
This could be then maintained by one page (xyz_warranty.php) instead of going in and editing many product pages that have this redundant info (when editing is needed).

I made a warranty.php (located in the incl/modules) but using the above php tag inserted into the products description does nothing (page displays, just no module)


Any help would be greatly appreciated!
Thank you.
define('PROJECTS', 'Something that goes on forever!');

#2 usernamenone

  • Community Member
  • 2,163 posts
  • Real Name:Lola
  • Gender:Female
  • Location:United States

Posted 05 June 2008, 16:03

I prefer to use an html output.

in your includes folder create a folder and name it text_output

inside that folder create a html page without header and footer tags and to do this you will just open notepad and create your html and save it as warranty.html

In your product discription use this code

<?php include('includes/text_output/warranty.html'); ?>

This can be placed in a table if you would like

#3 germ

  • Community Member
  • 13,471 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

Posted 05 June 2008, 19:39

You may have to do something like this:

Click Me
If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

"Headers already sent" - The definitive help

"Cannot redeclare ..." - How to find/fix it

SSL Implementation Help

Like this post? "Like" it again over there >

#4 FWR Media

  • Community Member
  • 6,462 posts
  • Real Name:Robert Fisher
  • Gender:Male
  • Location:Stowmarket - Suffolk - UK

Posted 05 June 2008, 20:10

View Postgerm, on Jun 5 2008, 08:39 PM, said:

You may have to do something like this:

Click Me

eval() is a useful function but an ENORMOUS security hole to be avoided where at all possible.

Perhaps something like the following could work.

In the products description where you want your code to appear just put the following: -

__XYZ_WARRANTY_PLACEHOLDER__

In the page where products description will be printed do something like as follows: -

<?php
ob_start();
include(DIR_WS_MODULES . 'xyz_warranty.php');
$warranty_info = ob_get_clean();
$product_info['products_description'] = str_replace('__XYZ_WARRANTY_PLACEHOLDER__' , $warranty_info, $product_info['products_description']);
?>

Then print $product_info['products_description'] it should contain your code.

Edited by FWR Media, 05 June 2008, 20:12.

Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls

KissMT Dynamic SEO Meta & Canonical Header Tags

KissER Error Handling and Debugging

If you found my post useful please click the green + sign to the right

Please only PM me for paid work.


#5 Top_Speed

  • Community Member
  • 357 posts
  • Real Name:KJ Miller
  • Location:SU-ville (Syracuse)

Posted 21 October 2008, 14:41

View Postusernamenone, on Jun 5 2008, 12:03 PM, said:

I prefer to use an html output.

in your includes folder create a folder and name it text_output

inside that folder create a html page without header and footer tags and to do this you will just open notepad and create your html and save it as warranty.html

In your product discription use this code

<?php include('includes/text_output/warranty.html'); ?>

This can be placed in a table if you would like

Could not get this method to work? followed easy instructs but the inserted "plain html" page would not display :(
define('PROJECTS', 'Something that goes on forever!');

#6 Jack_mcs

  • Community Member
  • 24,075 posts
  • Real Name:Jack
  • Gender:Male

Posted 21 October 2008, 16:00

See the embed links contribution. The other ways wil cause a loss of the session ID's.

Jack