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

Smarty fails at last hurdle!!?!

 
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
blingbling!!
Smarty Rookie


Joined: 30 Jul 2003
Posts: 5

PostPosted: Tue Oct 14, 2003 2:58 pm    Post subject: Smarty fails at last hurdle!!?! Reply with quote

Hi.

There seem to be some similar threads to this, but not identical. I've been using smarty for some time now, and i recently changed jobs. So i gets to the new place and says "hey - you guys should use smarty, it's great!!!" And it stops working...... Embarassed
Ok, so the problem seems to be that the compiled templates are just not doing anything. I've set up the /include directory, set the path to include the Smarty files (using ini_set() and by defining SMARTY_DIR), and the system seems to work ok. The templates_c/ directory has had some %%blah folders written in to it, inside which live 2 php files, corresponding to my 2 templates (i.e. data_list.tpl --> data_list.tpl.php). Only problem is that the .tpl.php files have no code in them, only a php coment in saying when they were compiled, and which template they were compiled from!!! I can't see that that i've done anything different here than the last time i used smarty, and smarty can obviously find the include/, templates/ and templates_c/ directories, orelse i wouldn't be getting this far!!!
Does anyone recognise this problem??? I'm reaching the end of my imagination here, my next attempt is going to be trying some older versions of smarty.

Thanks peeps!
Robin
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Tue Oct 14, 2003 4:02 pm    Post subject: Reply with quote

do you use any pre- or post-filters?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
blingbling!!
Smarty Rookie


Joined: 30 Jul 2003
Posts: 5

PostPosted: Wed Oct 15, 2003 8:19 am    Post subject: Reply with quote

I don't think i use any pre or post filters, unless there are some set by default.
However, i've managed to get my code working by downgrading smarty to an earlier version - version 2.4.1. I simply downloaded the older source, dropped the smarty class, compiler and config_file class into the include folder on my test site, and bingo!!!! I'm not sure what has happened here, but maybe this is a bug that has been introduced between 2.4.1 and 2.5.0????? If it's any use i could post some tarballs of my work to demonstrate this problem. If i've got time today, i'll have another go at getting 2.5.0 going, and post my results here.
Cheers!

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


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

PostPosted: Wed Oct 15, 2003 8:25 am    Post subject: Reply with quote

Sounds like your template contains syntax that is breaking in the new compiler. Have you tracked it down to a particular template? Do simple templates load?
Back to top
View user's profile Send private message
blingbling!!
Smarty Rookie


Joined: 30 Jul 2003
Posts: 5

PostPosted: Wed Oct 15, 2003 9:35 am    Post subject: Reply with quote

Ok, i've tried a simple template with 2.5.0, and it works ok with that. The syntax i'm using is quite involved, so maybe it's that which is breaking it. Here is a sample of the complex smarty syntax i'm using:
Code:


//in the PHP page:

$smarty->assign_by_ref("dlist", $dlist);

//in the template:
{section name=outer loop=$dlist->index}
   {if $smarty.section.outer.index is odd}
   <tr bgcolor="#cccccc">
   {else}
   <tr>
   {/if}
     <td align="left">
       {$dlist->list[outer]->student_snames}, {$dlist->list[outer]->student_fnames}
     </td>
     <td align="center">
       ???
     </td>
     {foreach from=$dlist->list[outer]->student_grades item=bingy}
     <td align="center">
       {$bingy}
     </td>
     {/foreach}
   </tr>
   
{/section}


The $dlist variable is an object, which holds an array of other objects. $index is a member variable of the 'parent' object, which is an integer holding the number of 'child'objects in the list. The $list variable is the array member variable of the 'parent' class. I'm not sure that this is the best possible OO practice, but this is really just demo code.
Also, in the PHP page, i use the 'fetch' method of smarty to execute the inner template (the one with the complex stuff in it) then pass the resulting variable called $content to the 'outer' template for display.
Ok, better get back to work now!!!

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


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

PostPosted: Wed Oct 15, 2003 10:44 pm    Post subject: Reply with quote

phew, that is fairly involved.

Are any errors being generated? Turn debug mode on and ensure that error reporting is at E_ALL. I'm wondering if you are getting a specific error or simply a blank page.
Back to top
View user's profile Send private message
phod
Smarty n00b


Joined: 29 Jul 2003
Posts: 4

PostPosted: Sun Nov 09, 2003 1:20 am    Post subject: Similar problem... Reply with quote

So strange, i feel the confusion of blingbling!!, i've been happilly using smarty since 2.3, and now because of php5 i've opted to take the wise-man's path and start developing on linux. (Mandrake 9.1 with Apache 1.3.29 and PHP5-b2 Infact), previously i was developing on WindowsXP (Professional Edition, with PHP-4.3.2 and Apache-2.something).

Ok, the scenario is... this is my webroot directory structure:

Code:

[lee@phod cmf1.0]$ ls /mnt/win_d/htdocs -R
config.inc.php* cmf1.0.php* cmf1.0/

/mnt/win_d/htdocs/cmf1.0:
cmf.sqlite*  includes/  includes.php*  inits/  inits.php*  templates/

/mnt/win_d/htdocs/cmf1.0/includes:
functions.inc.php*  GhostFS.inc.php*  libs/  SQLBasedDataSource.inc.php*

/mnt/win_d/htdocs/cmf1.0/includes/libs:
Config_File.class.php*  plugins/           Smarty_Compiler.class.php*
debug.tpl*              Smarty.class.php*

/mnt/win_d/htdocs/cmf1.0/includes/libs/plugins:
block.textformat.php*            modifier.count_paragraphs.php*
function.assign_debug_info.php*  modifier.count_sentences.php*
function.assign.php*             modifier.count_words.php*
function.counter.php*            modifier.date_format.php*
function.cycle.php*              modifier.debug_print_var.php*
  ...etc...

/mnt/win_d/htdocs/cmf1.0/inits:
ghost_fs.init.php*  sql_bds.init.php*  template.init.php*

/mnt/win_d/htdocs/cmf1.0/templates:
default/

/mnt/win_d/htdocs/cmf1.0/templates/default:
default.css*  test.tpl*


ok, and obviously cmf1.0.php is what i call (it has an `action` paramert i pass through _GET to make it do stuff).... anyhow, the templates are compiling...or rather the "compiled" files are being created but ... only with the smarty comment on them...also..if i erase everything from the .templates_c/ directory when i refresh cmf1.0.php i recieve these errors:

Code:

Warning: chmod() [function.chmod]: Operation not permitted in /mnt/win_d/htdocs/cmf1.0/includes/libs/Smarty.class.php on line 2062

Warning: touch() [function.touch]: Utime failed: Operation not permitted in /mnt/win_d/htdocs/cmf1.0/includes/libs/Smarty.class.php on line 1575


im not 100% sure if these are caused by php5 (i realise its still an unstable beta) or by a smarty bug, or indeed by a permissions problem - which (as far as what i know about linux goes) is inconcievable since both templates/ and .templates_c/ are chmod 777 - Apache is running as root, although im logged in as "lee", myself...im quite stumped and dont relish the idea of returning to either Windows or an earlier version of PHP.

Incase its any use ... here are the dumps of both the pre-compilation file (test.tpl) and the post-compile one too:

Pre:
Code:

<html>
  <head>
    <title>{$cmf_links.News}Test</title>
  </head>
  <body bgcolor="green">
  Testing
  </body>
</html>


Post:
Code:

<?php /* Smarty version 2.5.0, created on 2003-11-09 01:02:59
         compiled from /mnt/win_d/htdocs/cmf1.0/templates/test.tpl */
    ?>


Just as a final note, i've tried 2.4.1 and 2.4.2, i still get that same chmod() and touch() errors, and still nothing gets compiled into the file except the comment (ALso...just so you know i did clean out the . templates_c/) before i re-tried the different versions
Back to top
View user's profile Send private message
phod
Smarty n00b


Joined: 29 Jul 2003
Posts: 4

PostPosted: Sun Nov 09, 2003 12:01 pm    Post subject: ....after all that Reply with quote

After a tonne of hastle and a bunch of other stuff - i got some irc-type help and i've moved my webroot back to a ReiserFS partition and upgraded to the latest RC of 2.6.0 and its working just fine.. Cool so thanks to the good people of IRC and also to smarty for providing a solution!
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