X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   How to get help pages under help box (https://forum.x-cart.com/showthread.php?t=9989)

Gijs 10-24-2004 06:00 AM

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

pmstudios 10-24-2004 06:13 AM

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}

Gijs 10-24-2004 07:01 AM

Thanks pmstudios,

Works like a dream :lol:

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%"}




Gijs 10-24-2004 07:23 AM

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. :cry:

Anybody with an idea how to tackle this one :?:

Thanks in advance,

Gijs

pmstudios 10-24-2004 09:28 AM

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.

Gijs 10-24-2004 09:50 AM

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

pmstudios 10-24-2004 09:52 AM

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 !

Gijs 10-24-2004 02:56 PM

Got it
 
Hi pmstudios,

Couldn't sleep so back to work 8O

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 :lol:

Have a good night to ...

Gijs

pmstudios 10-24-2004 04:24 PM

Excellent :D

Gijs 10-24-2004 09:13 PM

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}



All times are GMT -8. The time now is 07:28 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.