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

Create a php page
 
Reply
   X-Cart forums > X-Cart 4 > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-15-2007, 04:28 AM
  Warwick's Avatar 
Warwick Warwick is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Somewhere on the web through European connection
Posts: 868
 

Question Create a php page

I have searched and tried for hours in a row but don't manage to create a php page which displays a certain lbl from the database. In static pages this works but I don't get it to work with a php page ...

Can somebody help me out with this?
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25
X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many
∙∙ Experience: Somewhere beyond newbie
-----------------------------------
------------------------------------------------------------------------------------------------------
Looking for the best dutch language pack? 4.1.x - 4.6.x compatibel, native speaker translation! More info
Reply With Quote
  #2  
Old 01-15-2007, 04:29 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Create a php page

Did you associate a .tpl file with the php file?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 01-15-2007, 04:49 AM
  Warwick's Avatar 
Warwick Warwick is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Somewhere on the web through European connection
Posts: 868
 

Default Re: Create a php page

I did the following; I created a .php file and a .tpl file as follows:

Php file (called new_page.php situated in shop directory):

Code:
<?php require "./auth.php"; require $xcart_dir."/include/categories.php"; if($active_modules["Manufacturers"]) include $xcart_dir."/modules/Manufacturers/customer_manufacturers.php"; if(!defined('XCART_SESSION_START')){ header("Location: ../"); die("Access denied");} $location[] = array(func_get_langvar_by_name("lbl_new_page"), "new_page.php"); $smarty->assign("_new_page_",$_new_page_); $smarty->assign("main","_new_page_"); $smarty->assign("location", $location); $smarty->assign("products",$products); func_display("customer/home.tpl",$smarty); ?>

Tpl file (called new_page.tpl situated in skin1/customer/):

Code:
{$lng.lbl_new_page}

In the language section of the database I've created 'lbl_new_page'

Opening new_page.php results in:
'Page not found! The requested page does not exist or you are not allowed to access it! '
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25
X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many
∙∙ Experience: Somewhere beyond newbie
-----------------------------------
------------------------------------------------------------------------------------------------------
Looking for the best dutch language pack? 4.1.x - 4.6.x compatibel, native speaker translation! More info
Reply With Quote
  #4  
Old 01-15-2007, 05:17 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Create a php page

Did you add the if statement to customer/home_main.tpl?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 01-15-2007, 05:20 AM
  Warwick's Avatar 
Warwick Warwick is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Somewhere on the web through European connection
Posts: 868
 

Default Re: Create a php page

Yes, sorry forgot to mention, I added

Code:
{* New page *} {elseif $main eq "new_page"} {include file="new_page.tpl"} {* New page End *}

under

Code:
{elseif $smarty.get.mode eq "unsubscribed"} {include file="main/unsubscribe_confirmation.tpl"}
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25
X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many
∙∙ Experience: Somewhere beyond newbie
-----------------------------------
------------------------------------------------------------------------------------------------------
Looking for the best dutch language pack? 4.1.x - 4.6.x compatibel, native speaker translation! More info
Reply With Quote
  #6  
Old 01-15-2007, 05:38 AM
  PhilJ's Avatar 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Location: UK
Posts: 3,587
 

Default Re: Create a php page

Should be...
Code:
{* New page *} {elseif $main eq "_new_page_"} {include file="new_page.tpl"} {* New page End *}
Reply With Quote
  #7  
Old 01-15-2007, 05:43 AM
  Warwick's Avatar 
Warwick Warwick is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Somewhere on the web through European connection
Posts: 868
 

Default Re: Create a php page

Thanks PhilJ,

I do get something else now:
Code:
Warning: Smarty error: unable to read resource: "new_page.tpl" in /home/my_name/public_html/shop/Smarty-2.6.12/Smarty.class.php on line 1095
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25
X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many
∙∙ Experience: Somewhere beyond newbie
-----------------------------------
------------------------------------------------------------------------------------------------------
Looking for the best dutch language pack? 4.1.x - 4.6.x compatibel, native speaker translation! More info
Reply With Quote
  #8  
Old 01-15-2007, 05:54 AM
  PhilJ's Avatar 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Location: UK
Posts: 3,587
 

Default Re: Create a php page

Ensure the new_page.tpl is in your /skin1 directory.
Reply With Quote
  #9  
Old 01-15-2007, 06:49 AM
  Warwick's Avatar 
Warwick Warwick is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Somewhere on the web through European connection
Posts: 868
 

Default Re: Create a php page

I got it working now, the new_page.tpl was in skin1/customer; I have placed it in skin1 and now it works Thanks for the help!
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25
X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many
∙∙ Experience: Somewhere beyond newbie
-----------------------------------
------------------------------------------------------------------------------------------------------
Looking for the best dutch language pack? 4.1.x - 4.6.x compatibel, native speaker translation! More info
Reply With Quote
  #10  
Old 03-21-2007, 02:57 AM
 
odonel odonel is offline
 

Newbie
  
Join Date: Dec 2006
Posts: 4
 

Default Re: Create a php page

do you get doubles warwick ? i tried that and i got doubles of everything. all i basically need to do is to display the best sellers on the left side of my site's main page ?
__________________
X-CART GOLD 4.18, mysql 4.025, php 5, IIS on 2K3
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > 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 12:55 PM.

   

 
X-Cart forums © 2001-2018