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

Create a New php Page?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-30-2005, 06:29 PM
 
Mr Bob Mr Bob is offline
 

Senior Member
  
Join Date: Jul 2005
Posts: 199
 

Default Create a New php Page?

I want to create a new php page that uses the template system of xcart.

I figured I could copy the contact us one, but it doesn't seem like it is going to work.

I don't believe I can start from scratch simply because I need to pass along the sessions and things like that.

Is there a page I can copy to start with, and then just create a few tpl files for the main content area? I want something similar to what appears on home.php, but there looks to be a lot of code inside that file that I would not want to use.

This has to have been answered in the past, but the search didn't turn up anything.
__________________
Product: X-Cart Gold
Current version: 4.0.14

Additional Mods: X-Affiliate
Reply With Quote
  #2  
Old 10-03-2005, 05:46 AM
 
instinctual instinctual is offline
 

eXpert
  
Join Date: Nov 2003
Posts: 247
 

Default

If it were me I would copy the register.php and the include/register.php and work from there. You will notice the include/register.php is called into the root register.php, and they are working off of skin1/customer/main/register.tpl.

If you follow that setup, you should be fine with creating your own new php page ;o)

Keep in mind you can also do similar things with "static pages" - but not sure what your goal is. Working with the static pages would be much easier...
__________________
Instinctual
8,000 feet up in the Rocky Mountains of Colorado
X-Cart Versions 3.5.x - 4.0.x

IF you xcart, THEN you prosper, ELSE you fail. ELSEIF xcart fails, THEN you fix it, all the WHILE {loop}\'ing {section}\'s to feed your $smarty mind.
Reply With Quote
  #3  
Old 10-03-2005, 08:35 AM
 
Mr Bob Mr Bob is offline
 

Senior Member
  
Join Date: Jul 2005
Posts: 199
 

Default

Thanks! I will give the register pages a try.

My goal is just to have a page that uses the smarty template system, I figured a PHP page would be the best to do this.

Thanks again
__________________
Product: X-Cart Gold
Current version: 4.0.14

Additional Mods: X-Affiliate
Reply With Quote
  #4  
Old 10-03-2005, 12:53 PM
 
Mr Bob Mr Bob is offline
 

Senior Member
  
Join Date: Jul 2005
Posts: 199
 

Default

I think it is going to have way too much useless information.

The include/register.php page contains about 900 lines of php code


The reason why I did not want static pages is because I want to be able to use webmaster mode to make text changes.

Also, I don't see anywhere that tells register.php to use register.tpl template
__________________
Product: X-Cart Gold
Current version: 4.0.14

Additional Mods: X-Affiliate
Reply With Quote
  #5  
Old 10-04-2005, 11:31 AM
 
Mr Bob Mr Bob is offline
 

Senior Member
  
Join Date: Jul 2005
Posts: 199
 

Default

I would have thought a lot more people would have known how to do this. Here are all the steps:


1. Create 'new_page.php' file in the '<xcart_root_dir>' with the following content :

---------------------------------------
<?php
require "./auth.php";

# Assign Smarty variables and show template
$smarty->assign("main","new_page");

func_display("customer/home.tpl", $smarty);
?>
---------------------------------------

2. Open '<xcart_root_dir>/skin1/customer/home_main.tpl' template and add following code :

---------------------------------------
{elseif $main eq "new_page"}
{include file="new_page.tpl"}
---------------------------------------

after the following fragment:

---------------------------------------
{elseif $smarty.get.mode eq "unsubscribed"}
{include file="main/unsubscribe_confirmation.tpl"}
---------------------------------------

3. Then create 'request_catalog.tpl' template in the '<xcart_root_dir>/skin1/' folder with the following content:

---------------------------------------
{$lng.lbl_new_page}
---------------------------------------

Then, when the customer opens the 'new_page.php' URL the standard X-Cart page will appear with the '{$lng.lbl_brochures_text}' language variable text in the central area.
__________________
Product: X-Cart Gold
Current version: 4.0.14

Additional Mods: X-Affiliate
Reply With Quote
  #6  
Old 10-04-2005, 11:43 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

dont forget to use the 'code' button when making a post. makes it much easier to read
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #7  
Old 10-04-2005, 11:49 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

You'll want to include your categories, etc., in your php file too. And set the location:

Code:
<?php require "./auth.php"; require $xcart_dir."/include/categories.php"; if ($active_modules["Manufacturers"]) include $xcart_dir."/modules/Manufacturers/customer_manufacturers.php"; if($active_modules["Bestsellers"]) include $xcart_dir."/modules/Bestsellers/bestsellers.php"; $location[] = array(func_get_langvar_by_name("lbl_your_language_variable", "")); # # Assign Smarty variables and show template # $smarty->assign("main","newpage"); # Assign the current location line $smarty->assign("location", $location); func_display("customer/home.tpl",$smarty); ?>
Reply With Quote
  #8  
Old 10-04-2005, 01:11 PM
 
Mr Bob Mr Bob is offline
 

Senior Member
  
Join Date: Jul 2005
Posts: 199
 

Default

I didn't put each bit into code tags because I thought it would have looked horrible.

Jon, can you explain a bit about this code segment?

Code:
$location[] = array(func_get_langvar_by_name("lbl_your_language_variable", ""));
__________________
Product: X-Cart Gold
Current version: 4.0.14

Additional Mods: X-Affiliate
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 08:47 AM.

   

 
X-Cart forums © 2001-2020