Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / adding content to a page

adding content to a page

Views: 600

Results 1 to 4 of 4
20 Jan 2011, 1:59 PM
#1
robwuk avatar

robwuk

Zen Follower

Join Date:
Aug 2005
Location:
United Kingdom
Posts:
458
Plugin Contributions:
0

adding content to a page

Hi, what i am after doing is i want to add some text at the top of the specials and new products etc which needs to change on a regular bases

Im familiar with template overides and adding extra pages to the shop that can be edited using the define pages editor in the admin, but i have had a look at the templates for specials and new products template and cant figure out how i would add the extra variables to add new content to the page

anyone point me in the right direction

Cheers

Rob

20 Jan 2011, 2:21 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: adding content to a page

Take an example of a page that currently works ...

Contact Us has its own
/includes/languages/english/html_lincludes/define_contact_us.php

that you copy to your templates and overrides directory ...

This is then called by the template file:
/includes/templates/template_default/templates/tpl_contact_us_default.php

by the code:

<?php if (DEFINE_CONTACT_US_STATUS >= '1' and DEFINE_CONTACT_US_STATUS <= '2') { ?>
<div id="contactUsNoticeContent" class="content">
<?php
/**
 * require html_define for the contact_us page
 */
  require($define_page);
?>
</div>
<?php } ?>

The line:
require($define_page);

has the $define_page set in the:
/includes/modules/pages/contact_us/header_php.php

in the code:

// include template specific file name defines
$define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_CONTACT_US, 'false');

To do the same on the Specials page, you can define that piece of code in your templates and overrides for the:
/includes/templates/template_default/templates/tpl_specials_default.php

so that you do not need to change more files than your templates and overrides for this ... and change the constants using contact_us to specials as needed ...

You would also need to define somewhere the values of the constants:
DEFINE_SPECIALS_STATUS
FILENAME_DEFINE_SPECIALS

That could be done in a file such as:
/includes/extra_datafiles/extra_define_pages.php

You can call that what ever you want, but that spells out what the file is for and can be used to add other new defines ...

Now putting all of this together would let you have a way to change the:
/includes/languages/english/html_lincludes/define_specials.php

20 Jan 2011, 4:22 PM
#3
robwuk avatar

robwuk

Zen Follower

Join Date:
Aug 2005
Location:
United Kingdom
Posts:
458
Plugin Contributions:
0

Re: adding content to a page

thankyou, i have it working

just to make sure ive done it correctly, i will just briefly explain incase you see a way i can streamline it

/includes/extra_datafiles/extra_define_pages.php

<?php /** * @package Pages * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 */ // Specials define('DEFINE_SPECIALS_STATUS', '2'); define('FILENAME_DEFINE_SPECIALS', 'define_specials'); ?>

/includes/modules/pages/specials/header_.php
// include template specific file name defines
$define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_SPECIALS, 'false');

/includes/templates/myoveridefolder/templates/tpl_specials_default.php

<?php if (DEFINE_SPECIALS_STATUS >= '1' and DEFINE_SPECIALS_STATUS <= '2') { ?> <div id="contactUsNoticeContent" class="content"> <?php require($define_page); ?> </div> <?php } ?>

includes/languages/english/html_includes/myoveridefolder/define_specials.php
this contains my text and images in html format

Ta for help

Rob

20 Jan 2011, 5:28 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: adding content to a page

Thanks for the update that this is working for you and especially for posting the step by step customizations summary that you made ... :smile: