Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

How to get help pages under help box

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-24-2004, 06:00 AM
  Gijs's Avatar 
Gijs Gijs is offline
 

eXpert
  
Join Date: Aug 2004
Location: Belgium
Posts: 295
 

Default How to get help pages under help box

Hi,

The title is perhaps a bit cryptic, so let me start with a little explenation.

On my home-page I use Cartlab Mod "Tabbed Menus".
When I click on "help", all the help-pages appear listed.
When I click on one of these help pages I'll be directed to help.php?section=whatever.

What would I like to achieve?
when I click one of the help-links the corresponding page appears under the box with all the links.
If that is not possible: help.php lists on top all the available topics and under that the corresponding pages appear.

On top of that:
The same principle I would like to perform with static pages which are listed.

Image example:
http://www.gbhwebsolutions.com/xcart/part12.jpg

Question:
Can anybody point me in the right direction ?

Thanks in advance !

Gijs
__________________
X-cart 4.1.11
PHP 5 MySQL 5
www.wheelpalace.eu
Reply With Quote
  #2  
Old 10-24-2004, 06:13 AM
 
pmstudios pmstudios is offline
 

Senior Member
  
Join Date: May 2004
Posts: 133
 

Default

Very simple.......

Just add the following to the top of help/index.tpl
Code:
{include file="help/general.tpl"}

and remove the last line where it's included after {else}
__________________
X-Cart 4.0.5
MySQL: 3.23.58
PHP 4.3.2
Reply With Quote
  #3  
Old 10-24-2004, 07:01 AM
  Gijs's Avatar 
Gijs Gijs is offline
 

eXpert
  
Join Date: Aug 2004
Location: Belgium
Posts: 295
 

Default

Thanks pmstudios,

Works like a dream

Here is the code to do the same with static-pages:

Edit: customer/main/pages.tpl

Code:
{capture name=dialog} {include file="pages_menu.tpl"} {/capture} {include file="dialog.tpl" title=$lng.lbl_tab_how_to content=$smarty.capture.dialog extra="width=100%"}
__________________
X-cart 4.1.11
PHP 5 MySQL 5
www.wheelpalace.eu
Reply With Quote
  #4  
Old 10-24-2004, 07:23 AM
  Gijs's Avatar 
Gijs Gijs is offline
 

eXpert
  
Join Date: Aug 2004
Location: Belgium
Posts: 295
 

Default

Now to some more serious stuff.

If you call pages.php without a pageid you'll get a pages not found error.

I would like to call pages.php directly and show a box with all the static-pages listed for the current shop language (= same principle as in the previous post).

I tempered around a bit with pages.php but got nowhere.

Anybody with an idea how to tackle this one

Thanks in advance,

Gijs
__________________
X-cart 4.1.11
PHP 5 MySQL 5
www.wheelpalace.eu
Reply With Quote
  #5  
Old 10-24-2004, 09:28 AM
 
pmstudios pmstudios is offline
 

Senior Member
  
Join Date: May 2004
Posts: 133
 

Default

You'll have to setup a template page to display the list of pages, but here is the modification for pages.php

Code:
if (isset($HTTP_GET_VARS["pageid"])) { # # Prepare data for editing # $preview = ($mode=="preview" ? "" : "AND active='Y'"); $page_data = func_query_first("SELECT filename, title FROM $sql_tbl[pages] WHERE pageid='$pageid' $preview AND level='E'"); if ($page_data) { $filename = $pages_dir.$page_data["filename"]; $page_content = func_file_get($filename, true); if ($page_content === false) { $page_content = "Page didn't found"; } $smarty->assign("page_data", $page_data); $smarty->assign("page_content", $page_content); $location[] = array($page_data["title"], ""); } else { func_header_location("error_message.php?page_not_found"); } } else { $pages = func_query("SELECT pageid, title FROM $sql_tbl[pages] WHERE language='$store_language' AND active='Y' ORDER BY orderby ASC"); $smarty->assign("pages", $pages); } $smarty->assign("main", "pages"); # Assign the current location line $smarty->assign("location", $location); func_display("customer/home.tpl",$smarty); ?>

Add the following to the top of customer/main/pages.tpl
Code:
{include file="customer/main/pages_title.tpl"}

Create new template file customer/main/pages_title.tpl
Code:
{capture name=dialog} {if $pages} {section name=id loop=$pages} {$pages[id].title} {/section} {else} {$lng.txt_no_pages_available} {/if} {/capture} {include file="dialog.tpl" title=$page_data.title content=$smarty.capture.dialog extra="width=100%"}

And of course whatever message you want for txt_no_pages_available, like "There are currently no pages available" or whatever you want.

This is really off the top of my head, so backup your files! I haven't tested it either, but hopefully it works or sets you in the right direction.
__________________
X-Cart 4.0.5
MySQL: 3.23.58
PHP 4.3.2
Reply With Quote
  #6  
Old 10-24-2004, 09:50 AM
  Gijs's Avatar 
Gijs Gijs is offline
 

eXpert
  
Join Date: Aug 2004
Location: Belgium
Posts: 295
 

Default

Hi pmstudios,

I doesn't run error free, but it comes quite close to what I want to achieve.

You definitely pointed me in the right direction :P

Gonna dedicated myself to it tomorrow and will report back

Thanks for your help, much appreciated.

Gijs
__________________
X-cart 4.1.11
PHP 5 MySQL 5
www.wheelpalace.eu
Reply With Quote
  #7  
Old 10-24-2004, 09:52 AM
 
pmstudios pmstudios is offline
 

Senior Member
  
Join Date: May 2004
Posts: 133
 

Default

I made a couple changes just now (forgot to include the language in the query), but good luck with it tomorrow and glad to help put you in the right direction !
__________________
X-Cart 4.0.5
MySQL: 3.23.58
PHP 4.3.2
Reply With Quote
  #8  
Old 10-24-2004, 02:56 PM
  Gijs's Avatar 
Gijs Gijs is offline
 

eXpert
  
Join Date: Aug 2004
Location: Belgium
Posts: 295
 

Default Got it

Hi pmstudios,

Couldn't sleep so back to work

So here it goes:

pages.php
Code:
<?php # # $Id: pages.php,v 1.1 2004/06/24 13:30:57 max Exp $ # # This script show static page in customer zone require "./auth.php"; require $xcart_dir."/include/categories.php"; if($active_modules["Manufacturers"]) include $xcart_dir."/modules/Manufacturers/customer_manufacturers.php"; $pages_dir = $smarty->template_dir."/pages/$store_language/"; if (isset($HTTP_GET_VARS["pageid"])) { # # Prepare data for editing # $preview = ($mode=="preview" ? "" : "AND active='Y'"); $page_data = func_query_first("SELECT filename, title FROM $sql_tbl[pages] WHERE pageid='$pageid' $preview AND level='E'"); if ($page_data) { $filename = $pages_dir.$page_data["filename"]; $page_content = func_file_get($filename, true); if ($page_content === false) { $page_content = "Page didn't found"; } $smarty->assign("page_data", $page_data); $smarty->assign("page_content", $page_content); $location[] = array($page_data["title"], ""); } else { func_header_location("error_message.php?page_not_found"); } } $smarty->assign("main", "pages"); # # Prepare list of all available Embedded pages for the current language # $pages = func_query("SELECT pageid, title FROM $sql_tbl[pages] WHERE active='Y' AND level='E' AND language='$store_language' ORDER BY orderby ASC"); $smarty->assign("pages", $pages); # Assign the current location line $smarty->assign("location", $location); func_display("customer/home.tpl",$smarty); ?>

costumer/main/pages.tpl
Code:
{* $Id: pages.tpl,v 1.3 2004/05/06 11:40:19 svowl Exp $ *} {include file="customer/main/pages_title.tpl"} {if $page_content ne ""} {capture name=dialog} {if $config.General.parse_smarty_tags eq "Y"} {eval var=$page_content} {else} {$page_content} {/if} {/capture} {include file="dialog.tpl" title=$page_data.title content=$smarty.capture.dialog extra="width=100%"} {/if}

customer/main/pages_title.tpl
Code:
<table width="100%"> <tr> <td align="center"><h1>How To Zone ==>change into $lng</h1></td> </tr> <tr> <td>Blablabla ==> change into $lng </td> </tr> </table> {capture name=dialog} {if $pages} {section name=id loop=$pages} {$pages[id].title} {/section} {else} No pages available {/if} {/capture} {include file="dialog.tpl" title="How To ? ==> change into lng-variable" content=$smarty.capture.dialog extra="width=100%"}

Works fine for me

Have a good night to ...

Gijs
__________________
X-cart 4.1.11
PHP 5 MySQL 5
www.wheelpalace.eu
Reply With Quote
  #9  
Old 10-24-2004, 04:24 PM
 
pmstudios pmstudios is offline
 

Senior Member
  
Join Date: May 2004
Posts: 133
 

Default

Excellent
__________________
X-Cart 4.0.5
MySQL: 3.23.58
PHP 4.3.2
Reply With Quote
  #10  
Old 10-24-2004, 09:13 PM
  Gijs's Avatar 
Gijs Gijs is offline
 

eXpert
  
Join Date: Aug 2004
Location: Belgium
Posts: 295
 

Default added a litle tweak

Hi pmstudios,

As I have a multi-lingual cart and I dont want some pages to appear in the pages list I've a the following twist to it


Code:
<table width="100%"> <tr> <td align="center"><h1>{$lng.lbl_tab_how_to}</h1></td> </tr> <tr> <td>{$lng.lbl_how_to_text} </td> </tr> </table> {if $store_language eq "NL"} {capture name=dialog} {section name=pg loop=$pages_menu} {if $pages_menu[pg].pageid ne "1"} {$pages_menu[pg].title} {/if} {/section} {/capture} {include file="dialog.tpl" title=$lng.lbl_tab_how_to content=$smarty.capture.dialog extra="width=100%"} {elseif $store_language eq "US"} {capture name=dialog} {section name=pg loop=$pages_menu} {if $pages_menu[pg].pageid ne "1"} {$pages_menu[pg].title} {/if} {/section} {/capture} {include file="dialog.tpl" title=$lng.lbl_tab_how_to content=$smarty.capture.dialog extra="width=100%"} {/if}
__________________
X-cart 4.1.11
PHP 5 MySQL 5
www.wheelpalace.eu
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:21 PM.

   

 
X-Cart forums © 2001-2020