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

Example Application problems

 
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 -> General
View previous topic :: View next topic  
Author Message
Gipsy
Smarty n00b


Joined: 04 Apr 2015
Posts: 2

PostPosted: Sat Apr 04, 2015 4:36 pm    Post subject: Example Application problems Reply with quote

Hello everybody,
i will learn to work with smarty. Smile

I saw the Example App "Guestbook" and i understand the example. (http://www.smarty.net/sampleapp1)

But i have two problems:

1. Start the index.php without database entries:
Code:
[i] Undefined variable: rows in C:\xampp\htdocs\guestbook\libs\guestbook.lib.php on line 137[/i]


2. Start the link to add a new entry:
Code:
[i]<br /><b>Notice</b>:  Undefined index: Name in <b>C:\xampp\htdocs\guestbook\templates_c\3349e32ab046f36b10e22ec6310c14cea064c43d.file.guestbook_form.tpl.php</b> on line <b>46</b><br />[/i]


=> the same as comment

Can you help me?

I know that the parameters are not defined, but i have no solution.
I have downloaded and run the example.

Thanks
Gipsy Cool
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Sat Apr 04, 2015 6:03 pm    Post subject: Reply with quote

This link should help.
Back to top
View user's profile Send private message
Gipsy
Smarty n00b


Joined: 04 Apr 2015
Posts: 2

PostPosted: Sun Apr 05, 2015 11:18 am    Post subject: Reply with quote

Hello AnrDaemon,
thank you for your reply.

At least the problem in the template "guestbook_form.tpl" I have solved.
I need to check the variable if it exists.

Code:
{if !isset($post.Name)} {$post.Name = ''} {/if}


Is that correct?

-------

Can you explain me how i can solve the other problem?

Start index.php page without database entries.

Code:
Notice: Undefined variable: rows in C:\xampp\htdocs\guestbook\libs\guestbook.lib.php on line 139


Do I need to check there if the variable exists?

Thanks and Regards
Gipsy
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sun Apr 05, 2015 1:13 pm    Post subject: Reply with quote

Note that the example is some older code originally written for Smarty 2.

It assumes that you have disabled E_NOTICE messages to handle unassigned template variables and may be other variables.
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 -> General 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