|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
kevinchj Smarty n00b
Joined: 25 Feb 2016 Posts: 1
|
Posted: Thu Feb 25, 2016 9:09 am Post subject: PHP code in smarty template |
|
|
Hello i am new here......
How do i include the following code in a .tpl file ?
<?php
require_once "share.class.php";
$share = new share(1);
$share->header()
?>
<?php if ($share->validate()){ ?>
This is the displayed content.
<?php } ?> |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Feb 25, 2016 9:39 am Post subject: |
|
|
I though that documentation was absolutely clear on that point?
Embedding barebone PHP code into templates is a ready security breach and should never be done. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Feb 25, 2016 3:40 pm Post subject: |
|
|
It might be better to clearly understand what you need a share class for, and why it creates a header. Whatever the content is that is coming out of header(), that is probably what you want in your template. You could also use smarty to create the content of header by calling $smarty->fetch() in your header() function. But whatever you do, you don't want to try to load your shareclass within Smarty, that should be done in the PHP code. |
|
Back to top |
|
|
|
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
|