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)
-   -   Create a php page (https://forum.x-cart.com/showthread.php?t=28026)

Warwick 01-15-2007 04:28 AM

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?

balinor 01-15-2007 04:29 AM

Re: Create a php page
 
Did you associate a .tpl file with the php file?

Warwick 01-15-2007 04:49 AM

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! '

balinor 01-15-2007 05:17 AM

Re: Create a php page
 
Did you add the if statement to customer/home_main.tpl?

Warwick 01-15-2007 05:20 AM

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


PhilJ 01-15-2007 05:38 AM

Re: Create a php page
 
Should be...
Code:

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


Warwick 01-15-2007 05:43 AM

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

PhilJ 01-15-2007 05:54 AM

Re: Create a php page
 
Ensure the new_page.tpl is in your /skin1 directory.

Warwick 01-15-2007 06:49 AM

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!

odonel 03-21-2007 02:57 AM

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 ?


All times are GMT -8. The time now is 09:48 AM.

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