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

pages.php

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

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

Default 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
__________________
X-cart 4.1.11
PHP 5 MySQL 5
www.wheelpalace.eu
Reply With Quote
  #2  
Old 11-24-2008, 08:14 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default 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");

__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote
  #3  
Old 11-24-2008, 10:04 PM
  Gijs's Avatar 
Gijs Gijs is offline
 

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

Default Re: pages.php

Thanks Victor,

Works like a charme !

Best regards,

Gijs
__________________
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 06:12 AM.

   

 
X-Cart forums © 2001-2020