Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Built site using linux have to upload to windows - errors

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
davro
Smarty Rookie


Joined: 15 Mar 2004
Posts: 13

PostPosted: Thu Apr 22, 2004 1:15 pm    Post subject: Built site using linux have to upload to windows - errors Reply with quote

Hi all
Hopefully someone can help me out

I have developed a smarty based website on linux with no probs at all.
But the problem is that the remote host im forced to upload to is a windows server, grrrr

This is the error im getting on all pages that use a variables from the get array.
Currently have these settings for the smarty object.
Code:

$smarty->compile_check = true;
$smarty->debugging = true;


Code:

Notice:  Undefined index:  page in C:\websites\internationalmoviestudiocom\html\templates_c\%%148\%%1488120802\DataNews.tpl.php on line 16


Current testing server link

I have to servers running with the same version of the website
1) Linux/Debian Works a charm
2) Windows Has errors

Please help

davro
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Apr 22, 2004 4:51 pm    Post subject: Reply with quote

This is not an error, but a notice which is being thrown whenever PHP can not access a var. If this is a production box, consider setting your error reporting to E_ALL & ~E_NOTICE.
Back to top
View user's profile Send private message
davro
Smarty Rookie


Joined: 15 Mar 2004
Posts: 13

PostPosted: Fri Apr 23, 2004 1:28 pm    Post subject: Reply with quote

Thanks for the reply boots

But im still not sure how to resolve this error, as im only assigning the var 'page'
To the template system, using the below code ??

Code:

if (is_array($recordArray)) {
    $page = ''; // attempt to define var 'page' for smarty  does not help ??
    $smarty->assign("page", $recordArray);
    $smarty->assign("page_count", $recordCount);
}


The error is thown up from the complied php file
Code:

Notice:  Undefined index:  page in C:\websites\internationalmoviestudiocom\html\templates_c\%%148\%%1488120802\DataNews.tpl.php on line 16


As im assigning the var 'page' to smarty giving the value of 'recordArray'
Should it be down to smarty to assign the variable 'page' ??

Davro
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Apr 23, 2004 8:20 pm    Post subject: Reply with quote

I'm a little stumped myself. I tried your link and I saw the notices. Are you certain you don't get them on your linux install when error reporting is set to E_ALL ? At any rate, from the code you posted I can't see the problem, I'm sorry to say.

(my default question here is to ask if you cleared your templates_c and cache dirs after you uploaded the files to the windows box)
Back to top
View user's profile Send private message
davro
Smarty Rookie


Joined: 15 Mar 2004
Posts: 13

PostPosted: Mon Apr 26, 2004 10:45 am    Post subject: Reply with quote

Hi boots

Think i might have solved the issue.
Before i actually collect the request from the database, i use this code to list the database
tables, to ensure the request is valid, the problem seems to be with the in_array check
i changed this statment to lower the string for the windows version and it now works ?
Well it work on windows now but not on linux, with the strtolower change.

Code:

// DATABASE : List and store db tables
while ($row = mysql_fetch_row($tables)) {
    if ($row[0] !== 'registry' && $row[0] !== 'login' && $row[0] !== 'profile') {
              $getTables[] = $row[0];
    }
}                                                                                                                                                                                                       
// TEMPLATE : Assign captured db tables to the templating system
$smarty->assign("tables", $getTables);

// REQUEST : Ensure the request is in the db tables array before collecting data
if (in_array(strtolower($requested), $getTables) ) { // windows
#if (in_array($requested, $getTables) ) { // linux
    // Gather data from database depending on request
}



I still do not really understand why windows is doing this as the requests are named like
News Reviews Listings with upper and lowercase chars, and the db tables are named
News Reviews Listings both upper and lowercase so windows must be converting the db tables or something to lower without asking ??

Thanks boots

davro
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Tue Apr 27, 2004 7:30 am    Post subject: Reply with quote

Hey again--good sleuthing!

It sounds like your issue is from MySQL: on Windows, it does not observe casing of tables/fields -- they all come out LC regardless of the DB definitions. To be portable between the two systems, ensure a sane naming policy that is transportable between all target systems -- here, only use LC in your SQL definitions. Too late for that now and not always an available option anyhow.

I guess that for now, you either have to make both sides of the comparison do a strtolower (so that it will continue to work on linux) or do some munging and only manage casing when run on a Windows system.

FWIW, you may want to consider using a db abstraction layer instead of going raw against the mysql functions. If nothing else, it gives you a central place to deal with these issues. You don't need a big abstraction layer either--I like DBX because as an extension, it is fast--though it is not available on all installations, I'm afraid. I also note that even if you use DBX, you should only access it via a custom wrapper.

HTH

ps. Also related to portability, are people really using mixed-case and spaces in table and field names these days? Wink
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP