Zen Cart Logo
Forums / Installing on a Linux/Unix Server / Page is unformatted like there's not a template

Page is unformatted like there's not a template

Locked

Views: 3,461

Results 1 to 20 of 24
This thread is locked. New replies are disabled.
23 May 2007, 1:34 AM
#1
maestro2020 avatar

maestro2020

New Zenner

Join Date:
May 2007
Posts:
1
Plugin Contributions:
0

Page is unformatted like there's not a template

I just installed version 1.3.7, and didn't change anything other than the basic setup stuff. Have a look here to see the appearance of the default site.

What's wrong - does anyone have a suggestion?
No error messages either.

Thanks.

24 May 2007, 11:20 PM
#2
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,799
Plugin Contributions:
15

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

either a bad path or bad database connect. Check to make sure your config files are correct.

2 Jun 2007, 9:08 PM
#3
baldwin14 avatar

baldwin14

New Zenner

Join Date:
Jun 2007
Posts:
15
Plugin Contributions:
0

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

Hi, I have just installed Zen Cart too, and am getting exactly the same problem. I have checked the database settings and they are correct. I think though from an earlier installation of Zen Cart on a server which was running mysql 4 (loads of dots appears when the demo stuff was been setup), the installation script isn't working correctly for PHP 5 + Mysql 5 servers - as the page with all the dots when selecting to upload the demo material didn't appear this time..which makes me think that the uploading and setting of the demo material part of the installation script has a bug in it. In fact I can definitely confirm this to be the case, as I just successfully installed the same script version of Zen Cart on another server.

The server specs are as follows:

** Server Host: ** www.japanesewoodblockprint.org (209.85.102.28) ** Database Host: ** localhost (127.0.0.1) ** Server OS: ** Linux server.tradewebhosting.com 2.6.9-42.0.10.ELsmp #1 SMP Fri Feb 16 17:17:21 EST 2007 i686 ** Database: ** MySQL 5.0.27-standard ** Server Date: ** 06/02/2007 17:04:44 ** Database Date: ** 06/02/2007 17:04:44 ** Server Up Time: ** 17:04:45 up 6 days, 23:31, 0 users, load average: 1.61, 1.84, 1.56
** PHP Version: ** 5.2.1 (Zend: 2.2.0)
** HTTP Server: ** Apache

My site is here:

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

3 Jun 2007, 10:54 AM
#4
baldwin14 avatar

baldwin14

New Zenner

Join Date:
Jun 2007
Posts:
15
Plugin Contributions:
0

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

Well I just spent over 6 hours checking and double checking all the configurations (especially those related to template paths) and I can find nothing wrong with the installation. Unless anyone here has any hints on how to get Zen-Cart working within the next 24 hours - using the template (I looked on google, and could find nothing that would help), than alas I will have to dump Zen Cart and find another package which works correctly on our server. Notice I put in some debug information at the top page, which shows that it is referencing the path correctly, just not using the information.

As mentioned, I know it is a bug in Zen-Cart, as I have successfully installed Zen-Cart elsewhere, but this particular domain cannot be moved to another server alas.

I hope to get some help soon, other than checking the configurations (which as you can see from my debug info live on the page, is fine).

Dave

3 Jun 2007, 11:20 AM
#5
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

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

Assuming that you did followed the installation instructions from the docs folder of this package, your server specs shows that you're using PHP v5.2.x. There are published patches on this forum which make a couple of corrections regarding similar issues (as yours could be included). Did you applied those patches ? :wink2:

3 Jun 2007, 11:30 AM
#6
baldwin14 avatar

baldwin14

New Zenner

Join Date:
Jun 2007
Posts:
15
Plugin Contributions:
0

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

re: TheOracle.

Thanks for responding, but alas I couldnt find any patches to apply - not obvious to me alas. However, I am still looking into the issue right now, and I think I know what is going wrong, if not how to fix it.

in the default template html_header.php file I have modified it as such:

/**

  • load all template-specific stylesheets, named like "style*.css", alphabetically
    */
    $directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^style/', '.css');

echo("<br>Styles: ".$template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'));

while(list ($key, $value) = each($directory_array)) {
echo("<br> $value");
echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value . '" />'."\n";
}
/**

It is correctly showing the path, but it isn't getting the style sheets, as can be seen in the line echo("<br>$value");

Any idea please which patch should be used ?

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

Thanks.

Dave

3 Jun 2007, 11:36 AM
#7
baldwin14 avatar

baldwin14

New Zenner

Join Date:
Jun 2007
Posts:
15
Plugin Contributions:
0

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

In fact, hehe, exactly where are the patches please ? I went to the most obvious location on this website (downloads), but couldnt find any link to patches? Are they on this forum somewhere? Maybe it should be made a bit more obvious on the download page - just a suggestion ?

Dave

3 Jun 2007, 11:49 AM
#8
baldwin14 avatar

baldwin14

New Zenner

Join Date:
Jun 2007
Posts:
15
Plugin Contributions:
0

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

As I cannot find the location of the Zen-Cart patches (given up for now), going to concentrate on fixing this myself, it hopefully will be quicker than looking through this website. Nice looking website by the way, but not very practical in layout - I had to go to google hehe to find the location of the forum, wouldn't it be nice to have a link called forum on the main Zen-Cart home page? I hope the book is better designed than the website :cool: Sorry to nit pick..

Anyhow I am 99% sure the bug is in the method: template->get_template_part() as that is certainly not returning the style sheet locations. Assuming it is in the main function code.

Will post my fix, unless I get completely stuck in here. But again, just out of interest, or I do get stumped, what is the url to the patches list ?

Thanks again,

Dave

3 Jun 2007, 11:56 AM
#9
econcepts avatar

econcepts

Totally Zenned

Join Date:
Dec 2005
Posts:
1,505
Plugin Contributions:
2

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

maestro2020:

I just installed version 1.3.7, and didn't change anything other than the basic setup stuff. Have a look here to see the appearance of the default site.

What's wrong - does anyone have a suggestion?

baldwin14:

Hi, I have just installed Zen Cart too, and am getting exactly the same problem.

Have you both checked out your permissions and the .htaccess file? This link may help.
https://www.zen-cart.com/tutorials/index.php?article=235

3 Jun 2007, 2:33 PM
#10
baldwin14 avatar

baldwin14

New Zenner

Join Date:
Jun 2007
Posts:
15
Plugin Contributions:
0

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

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

3 Jun 2007, 5:31 PM
#11
baldwin14 avatar

baldwin14

New Zenner

Join Date:
Jun 2007
Posts:
15
Plugin Contributions:
0

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

3 Jun 2007, 8:08 PM
#12
econcepts avatar

econcepts

Totally Zenned

Join Date:
Dec 2005
Posts:
1,505
Plugin Contributions:
2

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

baldwin14:

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.

3 Jun 2007, 8:18 PM
#13
econcepts avatar

econcepts

Totally Zenned

Join Date:
Dec 2005
Posts:
1,505
Plugin Contributions:
2

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

3 Jun 2007, 10:42 PM
#14
baldwin14 avatar

baldwin14

New Zenner

Join Date:
Jun 2007
Posts:
15
Plugin Contributions:
0

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.

3 Jun 2007, 11:02 PM
#15
baldwin14 avatar

baldwin14

New Zenner

Join Date:
Jun 2007
Posts:
15
Plugin Contributions:
0

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

4 Jun 2007, 2:09 AM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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?

4 Jun 2007, 10:59 PM
#17
baldwin14 avatar

baldwin14

New Zenner

Join Date:
Jun 2007
Posts:
15
Plugin Contributions:
0

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

5 Jun 2007, 7:42 PM
#18
baldwin14 avatar

baldwin14

New Zenner

Join Date:
Jun 2007
Posts:
15
Plugin Contributions:
0

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; 

}

5 Jun 2007, 8:08 PM
#19
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,799
Plugin Contributions:
15

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?

5 Jun 2007, 9:59 PM
#20
baldwin14 avatar

baldwin14

New Zenner

Join Date:
Jun 2007
Posts:
15
Plugin Contributions:
0

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