|
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 |
fl Smarty n00b
Joined: 15 Aug 2003 Posts: 1
|
Posted: Fri Aug 15, 2003 9:46 am Post subject: help~~~ how to create html button in smarty template?? |
|
|
hi all,
I'm new to smarty, and I wanna create a button like those in html (not checkbox or radio button) but don't know how to do it.
when the button is pressed, it will open another php file...
thx for any help |
|
Back to top |
|
CirTap Smarty Pro
Joined: 04 Jun 2003 Posts: 106
|
Posted: Fri Aug 15, 2003 10:08 am Post subject: |
|
|
Hi,
if the "button" is in a <form> use some vanilla submit button, if it's a <button> you'd need JavaScript to load/locate the other file.
Quote: | <html>
<body>
<!-- regular submit button -->
<form action="otherfile.php">
<input type="submit" />
</form>
<!-- javascript BUTTON >
<button onclick="self.location.href=('otherfile.php')">Go</button>
</body>
</html> |
'otherfile.php' can be a Smarty variable as well:
In your PHP File: $smarty->assign('GoToFile', 'otherfile.php');
In your template: action="{$GoToFile}" ... or self.location.href=('{$GoToFile}')
Watch out the double and single quotes! They belong to/are required by either HTML or JavaScript
Have fun,
CirTap |
|
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
|