View Single Post
  #15  
Old 11-14-2002, 02:58 PM
 
syddos syddos is offline
 

eXpert
  
Join Date: Sep 2002
Location: London, England, UK
Posts: 259
 

Default

Hi,

I had this problem when I first set eyes on xcart, and tried my first mod, (August 2002), I quickly discovered that the include "../include/get_language.php"; statement in some php files is responsible for transferring text from the database to your web pages.

WARNING! This file should only be called (included once) within any single web page request, otherwise you will get faults with messages like headers already started in ...../some other file

Example.
Quote:
Originally Posted by contents of auth.php
$current_area="C";

include "../include/partner_info.php";

include "../customer/referer.php";

include "../include/check_useraccount.php";

include "../include/get_language.php";

include "../customer/minicart.php";

include "../include/atracking.php";

if($active_modules["Subscriptions"]) {
if ($login) {
include "../modules/Subscriptions/get_subscription_info.php";
$smarty->assign("user_subscription", is_user_subscribed($login));
}
}

$smarty->assign("redirect","customer");

Quote:
Originally Posted by contents of home.php
$Id: home.php,v 1.28 2002/09/03 11:58:26 zorg Exp $
#

require "../smarty.php";
require "../config.php";
@include "./https.php";
require "./auth.php";


require "../include/categories.php";

if (!empty($cat))
require "./products.php";

require "./featured_products.php";

if($active_modules["Bestsellers"])
include "../modules/Bestsellers/bestsellers.php";

if(!empty($current_category)) $location = $category_location;
#
# Assign Smarty variables and show template
#

$smarty->assign("main","catalog");
$smarty->assign("location",$location);
$smarty->display("customer/home.tpl");
#

You will notice that home.php includes or requires auth.php, and that none of the files in auth.php is repeated in home.php.

One thing I not tried yet, is to see if the order in which the require file.php or include/file.php matters.

My website home page (not xcart home page) is generated by the xcart smarty/php code, and uses the xcart SQL database to store text and graphics. I also added a new $usertype of "V" (Visitor), with a "Enter Store" link from the website home page to xcart /customer/home page.

One other note: My development site (not the one in the "member websites") has only one original xcart element on the page ("search/categories"), all other elements are accessed by links, I had to write php files to sit between my link and the called php files. Why? The called smarty and php files assigned variables etc to the elements, and expected these elements to already be on the page, with assigned variables storing data to be passed to the called php file. When the elements were not found, smarty would produce error after error.

I'm no smarty/php expert, however when I need to do something, I learn just what code (smarty/php) I need to do the job, or copy an existing php function, change the arguments for my job and use that. I have been programming in JavaScript for some years, so I do understand a lot of the php code, it's smarty that normally trips me up.


Regards,
__________________
Syddos

Nothing is impossible, We just don't know how to do it ........Yet!

Xcart 4.1.X PRO (Testing Platform: winXP Pro)
Perl 5.8.7 (win32)
WINAMP 1.6.3 (win32 server package. Includes the following)
- phpMyAdmin v2.8.03
- MySql 5.0.21
- Apache 2.0.55 (win32)
- php 5.1.4
- SQLitemanager 1.2.0
Reply With Quote