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

syntax error: unbalanced parenthesis in if statement

 
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
kuddel99
Smarty n00b


Joined: 07 May 2018
Posts: 4

PostPosted: Mon May 07, 2018 4:28 pm    Post subject: syntax error: unbalanced parenthesis in if statement Reply with quote

Hello
i have a question, maybe someone knows the solution. Sorry, because i am a beginner.
i wrote following code in my template: kartei.tpl.
this is only extract. since i add the following code, i get: fatal error.
Code:


 <tr>
          {if (isset($_POST['muendl']))}
          <td>Datum mündl. Prüfung</td>
          <td>{if $klausurchanges == 0}<input type="text" size="20" name="pruefungsdatum_muendl" value="{$student.pruefungsdatum_muendl}" size="45" />{else}{$student.pruefungsdatum_muendl}{/if}</td>
          {/if}

      </tr>



it is so that i want to appear the input-field only if the button is clicked


Code:

 <input type="submit" name="muendl" value="mündl. Prüfung">


thanks for help, because i do not know what is wrong. i get the message: see topic
Back to top
View user's profile Send private message
bsmither
Smarty Elite


Joined: 20 Dec 2011
Posts: 322
Location: West Coast

PostPosted: Mon May 07, 2018 5:46 pm    Post subject: Reply with quote

Try changing:
Code:
{if (isset($_POST['muendl']))}
to
Code:
{if $smarty.post.muendl}
Back to top
View user's profile Send private message
kuddel99
Smarty n00b


Joined: 07 May 2018
Posts: 4

PostPosted: Mon May 07, 2018 5:54 pm    Post subject: Reply with quote

thanks , thats function ver well
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue May 08, 2018 8:57 am    Post subject: Reply with quote

bsmither wrote:
Try changing:
Code:
{if (isset($_POST['muendl']))}
to
Code:
{if $smarty.post.muendl}


More specifically,

Code:
{if isset($smarty.post.muendl)}


And you should avoid using unnecessary parenthesises, '()' will evaluate the enclosed expression which may affect the results.
Back to top
View user's profile Send private message
kuddel99
Smarty n00b


Joined: 07 May 2018
Posts: 4

PostPosted: Tue May 08, 2018 9:22 am    Post subject: Reply with quote

hello bsmither and AnrDaemon

thanks for help, let me ask you something more, please.
i changed to your proposal and thanks for that.

but since i changed it , the input-fields disappears after clicking save. but although the dates/information are in the database. before it was not so.

after clicking the button 'muendl' the input fields should stay.

Do you know why the disappers?

thanks for help
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue May 08, 2018 10:30 am    Post subject: Reply with quote

Make it stay?…
When you submit a form, the page is reloaded and will display whatever you've sent in response.
Back to top
View user's profile Send private message
bsmither
Smarty Elite


Joined: 20 Dec 2011
Posts: 322
Location: West Coast

PostPosted: Tue May 08, 2018 4:10 pm    Post subject: Reply with quote

At the end of the template, add {debug}.

When the page is delivered to the browser, the browser will want to popup a window. Let it do so.

Scan the left pane of the window for the $klausurchanges variable. Check its value.
Back to top
View user's profile Send private message
kuddel99
Smarty n00b


Joined: 07 May 2018
Posts: 4

PostPosted: Wed May 09, 2018 12:21 pm    Post subject: Reply with quote

thanks
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