Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24
  1. #11
    Join Date
    Jun 2007
    Posts
    15
    Plugin Contributions
    0

    Default Re: Page is unformatted like there's not a template

    Hi beginning to speculate that there is a bug with PHP 5.1 ? I have modified the get_template_part code as follows:

    function get_template_part($page_directory, $template_part, $file_extension) {
    $directory_array = array();

    if ($file_extension == '') {
    $file_extension = '.php';
    }

    $pdir = DIR_FS_CATALOG . $page_directory;

    echo("<br> Is $pdir a directory ? <br>");
    if (is_dir($pdir)) {
    echo("Yes, now getting contents of directory $pdir <br>");

    $files = glob($pdir . '/*.*');
    foreach ($files as $file) {
    $ftpy = filetype("$file");
    $pInfo = pathinfo("$file");
    $bname = $pInfo['basename'];
    if ($ftpy != "dir") {
    echo("debug scan: $bname is a $ftpy <br>");
    if ((substr($bname, strrpos($bname, '.')) == $file_extension) && preg_match($template_part, $bname)) {
    $directory_array[] = $bname;
    }
    }
    }

    rsort($directory_array);
    }

    return $directory_array;
    }


    As this link shows http://www.japanesewoodblockprint.org/cart/ it starts listing through all the directories well, and then suddenly stops doing so, for no reason at all. Does anyone know of any problems with directory functions under PHP 5, and how to resolve them ?

    I check directory properties, and they are fine too.

    Frankly close to giving up with Zen-Cart now. I hoped to have resolved this issue, but either the code or the PHP version has got the better of me.


    Dave

  2. #12
    Join Date
    Dec 2005
    Posts
    1,509
    Plugin Contributions
    6

    Default Re: Page is unformatted like there's not a template

    Quote Originally Posted by baldwin14 View Post
    re: econcepts.

    Thanks for that, but alas I already tried renaming the htaccess file, and it made no difference.

    I am debugging the code now, and will post my adjustments on here.


    Dave
    Yeah, just thought I'd throw it out there. Have you read through these threads as well? Not that they will help a ton, but they do discuss others using PHP5 / MYSQL5 etc.. with Zen just fine (leading me to believe it may not be the PHP5 install .. but then you never know).

    http://www.zen-cart.com/forum/showthread.php?t=44051

    http://www.zen-cart.com/forum/showthread.php?t=67063

    Again, just some more thoughts. You may also want to try to search Google for PHP5 Zen Cart installs and see if it turns anything up (while we look for a solution).

    I just heard this same problem with another user a few days ago, and they have never responded to what the answer (if any) was.
    Eric
    20 Ways to Increase Sales Using Zen Cart
    Zen Cart contribs: Simple Google Analytics, Export Shipping Information

  3. #13
    Join Date
    Dec 2005
    Posts
    1,509
    Plugin Contributions
    6

    Default Re: Page is unformatted like there's not a template

    Baldwin,

    Try this link. This is another thread where I answered the problem for another user and the solution did in fact run out to be the .htaccess file in the end (even though originally they thought it was not).

    http://www.zen-cart.com/forum/showthread.php?t=67311
    Eric
    20 Ways to Increase Sales Using Zen Cart
    Zen Cart contribs: Simple Google Analytics, Export Shipping Information

  4. #14
    Join Date
    Jun 2007
    Posts
    15
    Plugin Contributions
    0

    Default Re: Page is unformatted like there's not a template

    re: econcepts

    Many thanks for your information, I have tried all these suggestions, and more, but nothing is working. I am however, suspicious that it is a fundemental bug in PHP..

    for example.

    http://www.japanesewoodblockprint.org/cart/

    Works fine to start with finding the contents of each directory, but when it comes to the style sheet line Now getting contents of includes/templates/blue_sky/css/*.* (filter: .css), nothing is shown, no contents lists. I thought it was an access right issue, but then I copied the code used into a sep. test php script..(test.php) and called that directly..

    http://www.japanesewoodblockprint.org/cart/test.php

    and behold, it works..

    I can only imagine that in Php 5 there maybe somekind of memory leak, or overload somewhere, so if too many directory listings are called, it stops working.. My only guess right now. I even went as far as trying the clearstats function, but that didn't fix it either.

    Frankly clueless right now.. I might consider reporting this to the developers of PHP, as I dont see it as a reported issue on their website, and something is definately acting up.

    Thanks again for your help..

    Dave.

  5. #15
    Join Date
    Jun 2007
    Posts
    15
    Plugin Contributions
    0

    Default Re: Page is unformatted like there's not a template

    Hi Just letting you know that another friend of mine, using a completely different server, is having exactly the same problem as myself...

    Not sure if this is unique to this version of Zen-Cart, or the fact that a lot of servers out there are upgrading to PHP5 and Mysql 5 over all the security issues been highlighted in the press. I suspect the latter..but either way, the developers of Zen-Cart might wish to urgently review this.. the formatting problem is def. 100% due to the reading in of the template filenames in the function get_template_part() in the file template_func.php.

    One wild shot, and it is just a thought, are there any known issues in directory listings and using Zend PHP Optimiser ?


    I hope this information helps in anyway. Alas I cannot waste anymore time with Zend Cart, had to move on with an alternative, sorry...


    Dave

  6. #16
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Page is unformatted like there's not a template

    There were bugs in php 5.2 that caused problems that may have also been in php v5.1 ...

    What version Zen Cart are you running?

    And did you install it from our download or from somewhere else?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #17
    Join Date
    Jun 2007
    Posts
    15
    Plugin Contributions
    0

    Default Re: Page is unformatted like there's not a template

    Hi, just letting you know that I got Zen Cart installed.. but had to almost completely rewrite the template_part function to get it working.. ended up cache file contents to base64 coded files, as the directory fetching functions weren't working properly. My code is a bit makeshift right now, but once I have tried it up (hidden path to base64 coded files), i will make it public on here, in case anyone wishes to adopt this fix..


    Dave

  8. #18
    Join Date
    Jun 2007
    Posts
    15
    Plugin Contributions
    0

    Default Re: Page is unformatted like there's not a template

    My code fix is shown below.. However a new directory must be setup in the catalogue area.. in this example below it is called misc, and it must be read/writeable. If you wish to use another directory name, then change the variable $dir_cache (ideally this ought to become part of the configuration files). The original function can be found on the file template_func.php under /includes/classes of the current release. If you decide to use this routine, and your php/server is acting as weird as mine, you might need to press F5 or reload the website about 2 or 3 times for it to properly cache the template paths. I hope it helps someone out.. :-) Dave Baldwin.

    function get_template_part($page_directory, $template_part, $file_extension) {
    $directory_array = array();
    $icount = 0;

    if ($file_extension == '') {
    $file_extension = '.php';
    }

    // $pdir = DIR_FS_CATALOG . $page_directory;


    $pdir = $page_directory;

    $dir_cache = "misc/";

    if (is_dir($pdir)) {


    $b64 = base64_encode($pdir.$template_part.$file_extension);


    if (file_exists(DIR_FS_CATALOG . $dir_cache . $b64) ) {

    $handle = @fopen(DIR_FS_CATALOG . $dir_cache . $b64, "r");
    if ($handle) {
    while (!feof($handle)) {
    $bname = fgets($handle, 4096);
    $bname = trim($bname);
    if($bname != '') {
    // echo("$pdir $template_part $file_extension $b64 $bname <br>");
    $directory_array[] = $bname;
    }
    }
    fclose($handle);
    }


    } else {


    $gdir = $pdir . '/*.*';

    $listing = glob("$gdir");

    foreach ($listing as $file) {
    $ftpy = filetype("$file");
    $pInfo = pathinfo("$file");
    $bname = $pInfo['basename'];
    if ($ftpy != "dir") {
    if ((substr($bname, strrpos($bname, '.')) == $file_extension) && preg_match($template_part, $bname)) {
    $directory_array[] = $bname;
    $icount = $icount + 1;
    }
    }
    }

    if ($icount>0) {
    $f=fopen(DIR_FS_CATALOG . $dir_cache . $b64,"w");
    foreach ($directory_array as $bname) {
    fwrite($f, "$bname\n");
    }
    fclose($f);
    }

    }


    rsort($directory_array);

    }


    return $directory_array;
    }

  9. #19
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,688
    Plugin Contributions
    11

    Default Re: Page is unformatted like there's not a template

    Sorry, but I just can't help but think that you've rebuilt the entire automobile just to change the radiator cap.
    Perhaps you could answer Ajeh's question and also include the server info down to the PHP infobabble?
    A little help with colors.
    myZenCartHost.com - Zen Cart Certified, PCI Compatible Hosting by JEANDRET
    Free SSL & Domain with semi-annual and longer hosting. Updating 1.5.2 and Up.

  10. #20
    Join Date
    Jun 2007
    Posts
    15
    Plugin Contributions
    0

    Default Re: Page is unformatted like there's not a template

    I assure you it was the ONLY way to fix it, as directories werent been properly scanned (may or may not be a bug in PHP 5.1) I tried every other solution, and fixed it via this routine. It is there in case anyone else needs to use it.. I tried all the official Zen Cart hacks/mod patches and none of them resolved the problem.


    Dave

 

 
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Is there any addon for page info like this?
    By sharontan in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 8 Dec 2010, 05:57 PM
  2. Replies: 5
    Last Post: 13 Feb 2010, 10:15 PM
  3. new template - why does it not look like classic?
    By Chandy in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 28 Jul 2009, 08:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg