How can we allow the layer also able to parse syntax like {site_url()}? currently only editable page created at the backend able to parse this kind of syntax, but manually created view files are unable to.
Additionally, with a static view, you can pass it the variable of "parse_view" equal to TRUE in which case it will run the template parser on the view file.
So you are saying that you are using a view of "views/signup.php" that has fuel_set_var('js','a,b,c'); set at the top of it. You then have in your views/_layouts/main.php layout file: echo $this->asset->js($js);
// (As an FYI, you can use the "js($js)" function instead of $this->asset->js($js).)
Then in your controller you call: $this->fuel->pages->render('signup', $vars); And the js method isn't outputting the script tags for a, b and c. Is that correct?
In the code above, you specified the $vars['layout'] = 'general' and not 'main'. Is that still the case?
I just ran a test doing the same thing (but using the layout of 'main') and it worked OK. Is there a "signup" page also created in the CMS, or is it just a static view file?
Hmmm... I'm not sure. I'm not able to replicate that problem. You should be able to call fuel_set_var from within your view file and it will affect variables in the layout file like "js". Maybe perhaps try it with just a simple view called "test.php" that doesn't use a controller but has the fuel_set_var('js','a,b,c'); in it.
Comments
http://docs.getfuelcms.com/helpers/my_string_helper
Additionally, with a static view, you can pass it the variable of "parse_view" equal to TRUE in which case it will run the template parser on the view file.
function index(){
if(!isset($_SESSION)) session_start();
if(isset($_SESSION['LoggedIn'])){
header('Location: profile');
exit;
}
$vars['parse_view']=TRUE;
$vars['layout']='general';
$this->fuel->pages->render('signup', $vars);
}
my signup template is using a layout, all the {} variables in the layout is not parsed.
{$page_title}
Also, you can just use PHP syntax:
<?=$page_title?>
echo $this->asset->js($js);
?>
beside these,
are also not parsed.
The flow is there is a signup.php controller and a signup.php view which use a main.php layout file. all above codes lied in main.php
echo $this->asset->js($js); // (As an FYI, you can use the "js($js)" function instead of $this->asset->js($js).)
Then in your controller you call:
$this->fuel->pages->render('signup', $vars);
And the js method isn't outputting the script tags for a, b and c. Is that correct?
I just ran a test doing the same thing (but using the layout of 'main') and it worked OK. Is there a "signup" page also created in the CMS, or is it just a static view file?