Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / How can I include a page in a sidebox?

How can I include a page in a sidebox?

Locked

Views: 2,290

Results 1 to 18 of 18
This thread is locked. New replies are disabled.
16 May 2007, 12:54 AM
#1
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

How can I include a page in a sidebox?

I added a file to templates/sideboxes and want it to call a page but I can't figure the include call. This is what I have

<?php
/**
 * tpl_specials.php
 *
 * @package templateSystem
 * @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
 * @version $Id: tpl_specials.php 2982 2006-02-07 07:56:41Z birdbrain $
 */
  $content = "";
  $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';
  $content .= '<?include ('/languages/english/html_includes/define_ccdetails.php') ?>'; 
  $content .= '</div>';
?>

Can someone please help me figure the correct method to call this page. Thanks

16 May 2007, 2:01 AM
#2
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,611
Plugin Contributions:
0

Re: How can I include a page in a sidebox?

Well - for one thing you can't nest the <?php> tags.

16 May 2007, 2:35 AM
#3
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: How can I include a page in a sidebox?

Ok.. so what is the correct method of including a page

16 May 2007, 5:59 PM
#4
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: How can I include a page in a sidebox?

Any suggestions on this??

17 May 2007, 2:37 AM
#5
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: How can I include a page in a sidebox?

Still searching for the method.... anyone?

17 May 2007, 4:57 PM
#6
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: How can I include a page in a sidebox?

Is it that this is not possible? Just a little help... please :(

17 May 2007, 5:19 PM
#7
ajeh avatar

ajeh

Oba-san

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

Re: How can I include a page in a sidebox?

You mean add an include like all of the tpl_page_X_default.php and tpl_contact_us_default.php and tpl_shippinginfo_default.php

If so, you might peek at those files and see how the requires work ...

The $define_page is set in the header_php.php of each of those pages, example:
/includes/pages/shippinginfo

$define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_SHIPPINGINFO, 'false');
18 May 2007, 5:55 AM
#8
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: How can I include a page in a sidebox?

Well I really don't know what all that does or how to apply it. All I want is to make a page with content display within a sidebox I created.

I created in includes/templates/template_default/tpl_textbox.php and it looks like this

<?php
/**
 * Side Box Template
 *
 * @package templateSystem
 * @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
 * @version $Id: tpl_search.php 4142 2006-08-15 04:32:54Z drbyte $
 */
  $content = "";
  $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';
  $content .= I WANT TO INCLUDE A PAGE HERE what code does this
  $content .= '</div>';
?>

Then I created a corresponding file in includes/modules/sideboxes/textbox.php to make it appear in the layout boxes list in the admin area.

<?php
/**
 * search sidebox - displays keyword-search field for customer to initiate a search
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: search.php 2834 2006-01-11 22:16:37Z birdbrain $
 */

  require($template->get_template_dir('tpl_textbox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_textbox.php');

  $title = '<label>' . BOX_HEADING_TEXTBOX . '</label>';
  $title_link = false;
  require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
?>

I also created a file in includes/languages/english/html_includes/define_textbox.php which I can write to from the define pages editor in the admin. I want this page (define_textbox.php) to be called into the side box. How can this be done.

18 May 2007, 3:40 PM
#9
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: How can I include a page in a sidebox?

I've spent so many hours on this and can't get any success. Can someone please tell me how to create an html_includes/define_page.php that I can edit with the define pages editor and make it display in the sideboxes?

All went well with creating the side box and able to display it on the page but I need to get the content in it.

19 May 2007, 8:22 AM
#10
ivan_xjk avatar

ivan_xjk

New Zenner

Join Date:
Dec 2006
Posts:
6
Plugin Contributions:
0

Re: How can I include a page in a sidebox?

I have the same problem of yours. I can add pages to sideboxes, for eg: add page_7.html to "more information " sideboxes, the page_7.html created and can be edited from admin->tools->define page editor, but the new page_7.html is empty!
help!!!!:frusty:

19 May 2007, 3:15 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: How can I include a page in a sidebox?

To add a page such as the define page for shipping_info to a sidebox like:
/includes/modules/sideboxes/more_information.php

copy to your templates and overrides directory:
/includes/modules/sideboxes/your_template_dir/more_information.php

You can use:

    $add_a_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_SHIPPINGINFO, 'false');
    $more_information[] = require($define_page);

To add to a tpl_something.php you would use:

    $add_a_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_SHIPPINGINFO, 'false');
  $content .= require($add_a_page);
20 May 2007, 7:20 PM
#12
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: How can I include a page in a sidebox?

Ajeh I really appreciate the help you attempt. However you are presenting it as if to a fellow programmer at your level and I am not even a beggining programmer.

All that you have posted really is not logical to me so I don't know how to apply it. If you could just present the fix for the file structure that I have created all will be solved. Please just look over the codes I have below and add the correct codes in the exact way to make this work.

I am not using the override, just changing the files of the default.

Files created:

  1. The file that collects the info from the text editor in admin - Working perfect. It shows up in the list of the Define Pages Editor and I can write to it using the text editor
    includes/languages/english/html_includes/define_textbox.php

  2. The file that displays the sidebox choice in the Layout Boxes Controller in admin - Working perfectly. I see it in the list of define pages and can choose it and displays on the site pages correctly
    includes/modules/sideboxes/textbox.php

<?php /** * new side box * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: search.php 2834 2006-01-11 22:16:37Z birdbrain $ */ require($template->get_template_dir('tpl_textbox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_textbox.php'); $title = '<label>' . BOX_HEADING_STUFF . '</label>'; $title_link = false; require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default); ?>
  1. The file that is to call the content from define_tecxtbox.php - Not working.
    includes/templates/template_default/sideboxes/tpl_textbox.php
<?php /** * Side Box Template * * @package templateSystem * @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 * @version $Id: tpl_search.php 4142 2006-08-15 04:32:54Z drbyte $ */ $content = ""; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">'; $add_a_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_TEXTBOX, 'false'); $content .= 'This is where I want the include page. If I write the content here like this red text sentence then it appears on the site pages without error but I'd rather have the include page.'; $content .= '</div>'; ?>
22 May 2007, 12:14 AM
#13
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: How can I include a page in a sidebox?

Many others will benefit from this if it is ever figured

22 May 2007, 12:48 AM
#14
ajeh avatar

ajeh

Oba-san

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

Re: How can I include a page in a sidebox?

Where is this defined?
FILENAME_DEFINE_TEXTBOX

What do you have it set to?

22 May 2007, 3:46 PM
#15
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: How can I include a page in a sidebox?

I created a header_php.php in includes/modules/pages/textbox/

<?php /** * Page 2 * * @package page * @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 * @version $Id: header_php.php 3230 2006-03-20 23:21:29Z drbyte $ */ require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php')); $breadcrumb->add(NAVBAR_TITLE); // include template specific file name defines $add_a_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_TEXTBOX, 'false'); $more_information[] = require($define_page); ?>

based on my interpretation of previous instructions

24 May 2007, 2:45 AM
#16
ajeh avatar

ajeh

Oba-san

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

Re: How can I include a page in a sidebox?

This constant itself needs to be defined:
FILENAME_DEFINE_TEXTBOX

You have to have somewhere a define statement that says what that constant means ...

Example, page 2 is setup as:

define('FILENAME_DEFINE_PAGE_2', 'define_page_2');

You need to have your constant setup as well ...

This can be done in your own file in the:
/includes/extra_datafiles

Create your own file such as:
/includes/extra_datafiles/my_defines.php

<?php
define('FILENAME_DEFINE_TEXTBOX', 'define_textbox.php');
?>

This is an autoloading directory ...

9 Aug 2007, 5:08 PM
#17
minnie_mouse avatar

minnie_mouse

Zen Follower

Join Date:
Jun 2005
Posts:
119
Plugin Contributions:
0

Re: How can I include a page in a sidebox?

hi, i am also trying to do this. i almost have it, but for the life of me cannot figure out why it is doing the following: placing the text from the define page (define_page_5) outside the template for the sidebox.

so it looks like this...
define page_5 text
rightboxheading
rightboxcontent= 1

here is what my code looks like on the tpl_more_information.php page
$content = '';
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n" ;
$add_a_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_PAGE_5, 'false');
$content .= require($add_a_page);
$content .= '</div>';
the div appears below the define page content.

9 Aug 2007, 5:10 PM
#18
minnie_mouse avatar

minnie_mouse

Zen Follower

Join Date:
Jun 2005
Posts:
119
Plugin Contributions:
0

Re: How can I include a page in a sidebox?

oh, and then i get a 1 inside the div, as if its telling me that $more_information exists...