View previous topic :: View next topic |
Author |
Message |
TheEditor Smarty Rookie
Joined: 22 Nov 2011 Posts: 12
|
Posted: Tue Nov 22, 2011 5:55 pm Post subject: |
|
|
The SQL file might be amended to include an INSERT statement.
After inserting a test record the message I'm getting now is
Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'guestbook.tpl'' in C:\wamp\www\sampleapp\smarty\sysplugins\smarty_internal_templatebase.php on line 127
That looks like a config error, but I'm not sure what I messed up. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Nov 22, 2011 8:12 pm Post subject: |
|
|
Make sure guestbook.tpl is in the template directory and readable, and you have that directory path configured properly. You can also use $smarty->testInstall() to see if all the directories are setup correctly. |
|
Back to top |
|
TheEditor Smarty Rookie
Joined: 22 Nov 2011 Posts: 12
|
Posted: Tue Nov 22, 2011 8:26 pm Post subject: |
|
|
In the guestbook application, where would I best place the testinstall call? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Nov 22, 2011 8:30 pm Post subject: |
|
|
TheEditor wrote: | In the guestbook application, where would I best place the testinstall call? |
Right after everything is setup in Smarty. On the last example, just after you initialize the extended object would do. |
|
Back to top |
|
TheEditor Smarty Rookie
Joined: 22 Nov 2011 Posts: 12
|
Posted: Tue Nov 22, 2011 8:32 pm Post subject: |
|
|
guestbook.tpl is where I think it should be:
C:\wamp\www\sampleapp\guestbook\templates
That is the path specified in the zip file - \sampleapp\guestbook\templates\. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Nov 22, 2011 8:33 pm Post subject: |
|
|
Ah, it looks like the example is using pre Smarty 3.1 settings. Change these:
Code: | $this->template_dir = GUESTBOOK_DIR . 'templates';
$this->compile_dir = GUESTBOOK_DIR . 'templates_c';
$this->config_dir = GUESTBOOK_DIR . 'configs';
$this->cache_dir = GUESTBOOK_DIR . 'cache'; |
to:
Code: | $this->setTemplateDir(GUESTBOOK_DIR . 'templates');
$this->setCompileDir(GUESTBOOK_DIR . 'templates_c');
$this->setConfigDir(GUESTBOOK_DIR . 'configs');
$this->setCacheDir(GUESTBOOK_DIR . 'cache'); |
|
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Nov 22, 2011 8:41 pm Post subject: |
|
|
sample app is updated... |
|
Back to top |
|
TheEditor Smarty Rookie
Joined: 22 Nov 2011 Posts: 12
|
Posted: Tue Nov 22, 2011 8:46 pm Post subject: |
|
|
Ok, that seems to help things a lot. You can understand my frustration. |
|
Back to top |
|
TheEditor Smarty Rookie
Joined: 22 Nov 2011 Posts: 12
|
Posted: Tue Nov 22, 2011 9:14 pm Post subject: |
|
|
Ok, I've got just one more problem with the sample app. The SQL script isn't working quite right. Specifically the CREATE TABLE statement:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 8
I'm trying to get the sample app running on two separate boxes, both running identical wampserver installs. On one this works just fine. On the other I get this error.
I realize this is probably a phpMyAdmin/MySQL issue. Any ideas? Looks pretty plain vanilla stuff to me.
Last edited by TheEditor on Tue Nov 22, 2011 9:23 pm; edited 1 time in total |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Nov 22, 2011 9:17 pm Post subject: |
|
|
TheEditor wrote: | Ok, I've got just one more problem with the sample app. The SQL script isn't working quite right. Specifically the CREATE TABLE statement:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 8
I'm trying to get the sample app running on two separate boxes, both running identical wampserver installs. On one this works just fine. On the other I get this error. I can still
I realize this is probably a phpMyAdmin/MySQL issue. Any ideas? Looks pretty plain vanilla stuff to me. |
Try just removing TYPE=MyISAM, or change it to ENGINE=MyISAM. It's a mysql version issue. |
|
Back to top |
|
TheEditor Smarty Rookie
Joined: 22 Nov 2011 Posts: 12
|
Posted: Tue Nov 22, 2011 9:29 pm Post subject: |
|
|
Ahh, that gets it. Now when I try to add an entry to the guestbook via
http://localhost/sampleapp/docs/index.php?action=add
the app throws an error
Notice: Undefined index: Name in C:\wamp\www\sampleapp\guestbook\templates_c\69c6e7be3c5be18e504253fcc3697135a767ea73.file.guestbook_form.tpl.php on line 46
Seems to be something wrong with
$_smarty_tpl->tpl_vars['post']->value['Name']
on line 46 of the template. Any ideas? |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Nov 22, 2011 10:15 pm Post subject: |
|
|
add
$this->error_reporting = E_ALL & ~ E_NOTICE;
to the constructor in guestbook_setup.php |
|
Back to top |
|
TheEditor Smarty Rookie
Joined: 22 Nov 2011 Posts: 12
|
Posted: Wed Nov 23, 2011 1:43 am Post subject: |
|
|
Now it looks like I've got a working sample app. Much thanks.
But that last bit, if I'm reading it right, just means that an error was passed over and not reported. Why was the error thrown in the first place? I'm just a newbie here, but the line looked fine. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Nov 23, 2011 2:57 am Post subject: |
|
|
When the database was empty there was novalue assigned to the Smarty variable $post. Accessing {$post.Name} in the template did genearte the notice. Smarty2 did disable E_NOTICE automatically during template processing so undefined varibles have been silently ignored. In Smarty3 E_NOTICE has to be supressed by the statement to get same behaviour.
Many users and also this example does use E_NOTICE suppression as a "lazy" way to deal with unassigned variables. |
|
Back to top |
|
TheEditor Smarty Rookie
Joined: 22 Nov 2011 Posts: 12
|
Posted: Wed Nov 23, 2011 3:09 am Post subject: |
|
|
Thanks much for the help. Time for me to move on to TinyMVC, and then to integrating the pair. |
|
Back to top |
|
|