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)
-   -   pages.php (https://forum.x-cart.com/showthread.php?t=43843)

Gijs 11-24-2008 06:31 AM

pages.php
 
Hi,

It's has been a couple of years since my last post and I'm not really familiar with the 4.1.xx branch yet.

I'm having some problems displaying static pages.

What I done so far:

1) When you click on a static page.
The list of static pages show up + the actual static page


customer/main/pages.tpl

Code:

{* $Id: pages.tpl,v 1.5 2005/11/17 06:55:37 max Exp $ *}


{capture name=dialog}
{include file="pages_menu.tpl"}
{/capture}
{include file="dialog.tpl" title=$lng.gh_tab_info content=$smarty.capture.dialog extra="width=100%"}

<br /><br />



{capture name=dialog}
{if $page_content ne ''}
{if $config.General.parse_smarty_tags eq "Y"}
{eval var=$page_content}
{else}
{$page_content}
{/if}
{/if}
{/capture}
{include file="dialog.tpl" title=$page_data.title content=$smarty.capture.dialog extra='width="100%"'}


2) What I like to do is call pages.php directly and show the list of static pages.

In customer/home_main.tpl

the following is stated:
Code:

{elseif $main eq "pages"}
{include file="customer/main/pages.tpl"}


Unfortunately when I call pages.php only an error message shows up:

Page not found!
The requested page does not exist or you are not allowed to access it!


Can some one point me in the right direction ?

Thanks in advance,

Gijs

Victor D 11-24-2008 08:14 AM

Re: pages.php
 
you likely need to prevent pages.php from raising error if no page content found
replace
PHP Code:

if (isset($HTTP_GET_VARS["pageid"])) {
#
# Prepare data for editing
#
    
$preview = ($mode=="preview" "" "AND active='Y'");
    
$page_data func_query_first("SELECT * FROM $sql_tbl[pages] WHERE pageid='$pageid$preview AND level='E'");

    if (
$page_data["language"] != $store_language) {
        
$page_data func_query_first("SELECT * FROM $sql_tbl[pages] WHERE filename='$page_data[filename]$preview AND level='E' AND language='$store_language'");
    }

    if (
$page_data) {
        
$filename $pages_dir.$page_data["filename"];
        
$page_content func_file_get($filenametrue);
        if (
$page_content === false) {
            
$page_content func_get_langvar_by_name("lbl_page_not_found", array(), falsetrue);
        }
        
$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");


with
PHP Code:

if (isset($HTTP_GET_VARS["pageid"])) {
#
# Prepare data for editing
#
    
$preview = ($mode=="preview" "" "AND active='Y'");
    
$page_data func_query_first("SELECT * FROM $sql_tbl[pages] WHERE pageid='$pageid$preview AND level='E'");

    if (
$page_data["language"] != $store_language) {
        
$page_data func_query_first("SELECT * FROM $sql_tbl[pages] WHERE filename='$page_data[filename]$preview AND level='E' AND language='$store_language'");
    }

    if (
$page_data) {
        
$filename $pages_dir.$page_data["filename"];
        
$page_content func_file_get($filenametrue);
        if (
$page_content === false) {
            
$page_content func_get_langvar_by_name("lbl_page_not_found", array(), falsetrue);
        }
        
$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");
}  else {
    
$smarty->assign("main""pages");



Gijs 11-24-2008 10:04 PM

Re: pages.php
 
Thanks Victor,

Works like a charme !

Best regards,

Gijs


All times are GMT -8. The time now is 02:21 AM.

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