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

Missing template name smarty_template_source.php line 157

 
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
thiebo
Smarty Pro


Joined: 16 Jan 2005
Posts: 144
Location: Paris

PostPosted: Wed Feb 03, 2016 9:26 pm    Post subject: Missing template name smarty_template_source.php line 157 Reply with quote

Hello,

I'm running into a problem that I suppose is caused by include but not too sure about that.

Here is my index.php

Code:
<?php
session_start();
// all requires and setting variables not copied here

if(empty($_POST)){
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('fprenom','prenom','notEmpty');
// several validators, not all copied
    $smarty->assign ('template',$template);
    $smarty->display($index_template);
}
else {
    SmartyValidate::connect($smarty);

    if(SmartyValidate::is_valid($_POST)){
        SmartyValidate::disconnect();
        $smarty->display ('index_chirhadach.tpl');
    }else{
        $smarty->assign($_POST);
        $smarty->assign ('outil','nl');
        $smarty->display($index_template);
    }
}
?>


This is my index.tpl :
Code:

{include file='header.tpl'}

    {include file='chirTete.tpl'}
    {include file='menu.tpl'}
    {include file= $template}

{include file='footer.tpl'}
{include file='close.tpl'}



The {$template} is newsletter.tpl that contains:
Code:

<div class="col-md-6">
{include "add_personne_form.tpl"}
<!--- newsletter subscription form -->
 </div>


and add_personne_form.tpl contains this :
Code:

<form method="post" action="index.php" class="form-horizontal">
{include file='addmembre.tpl'}
<!-- addmember contains the main part of the form, see below -->
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-default">Ajouter</button>
        </div>
    </div>
</form>


here's addmembre.tpl..... That's where the validate ids are !

Code:
<div class="form-group">

    {validate id="fprenom" message = "Il faut remplir son prénom"}

        <label for="inputPrenom" class="col-sm-2 control-laber">Prénom *</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" id="prenom" name="prenom" placeholder="Prénom">
        </div>
    </div>

    <div class="form-group">
   
    {validate id="fnom" message = "Il faut remplir son nom"}
   
    <label for="inputNom" class="col-sm-2 control-laber">Nom *</label>
        <div class="col-sm-10">
            <input type="nom" class="form-control" id="nom" name="nom" placeholder="Nom">
        </div>
    </div>



I tested the template names etc and without smarty validate it all works fine. But with smarty validate I get this error message, whether I fill out a valid form or a form that is not valid :

Quote:
Fatal error: Uncaught --> Smarty: Missing template name <-- thrown in /Library/WebServer/Documents/chirhadach/libs/sysplugins/smarty_template_source.php on line 157


That error doesn't say what template Smarty is looking for, but I guess it's index.tpl and the includes are causing this error...
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Feb 03, 2016 10:26 pm    Post subject: Reply with quote

does $index_template have a value? it acts like you are passing an empty template name.
Back to top
View user's profile Send private message Visit poster's website
thiebo
Smarty Pro


Joined: 16 Jan 2005
Posts: 144
Location: Paris

PostPosted: Thu Feb 04, 2016 7:04 am    Post subject: Reply with quote

got it....
Code:

$smarty->assign('template',$template);


was only in the first block if empty post. That was the missing template, not newsletter_index.tpl.

Not a smarty problem at all Embarassed
Back to top
View user's profile Send private message Visit poster's website
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