|
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 |
Mecadie Smarty n00b
Joined: 25 Sep 2017 Posts: 2
|
Posted: Mon Sep 25, 2017 10:35 am Post subject: Using Smarty with Bootstrap |
|
|
Hello everyone, I'm newbi with Smarty and I would like to use it with Bootstrap.
First of all, sorry for my english I'm not a native
I am able to use the Bootstrap's CSS, it works fine but I'm not able to use the jQuery of bootstrap
for exemple :
I want to create a button wich open a modal screen on click, but it doesn't work when I'm using smarty (works well when i'm not using smarty)
so i give you some code exemple :
1 : I include smarty to my configuration file
Code: | include('/usr/share/php/smarty3/Smarty.class.php'); |
2 : I include my configuration file into index.php AND I use my templates :
Code: |
include('./config/config_init.php');
$smarty->display(_VUES_ . 'header.tpl');
if (isset($_GET['page']) && file_exists(_VUES_.'pages/'.str_replace('.', '', $_GET['page']).'.tpl'))
$smarty->display(_VUES_.'pages/'.$_GET['page'].'.tpl');
else
$smarty->display(_VUES_ . 'pages/index.tpl');
$smarty->display(_VUES_ . 'footer.tpl');
?> |
3 : A button who should open a modal screen on click :
Code: | <button data-toggle="modal" href="#infos" class="btn btn-default btn-block btn-mainMenu">
<div class="row">
<p>BUTTON'S TITLE</p>
</div>
</button>
<div class="modal" id="infos">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span class="fa fa-window-close fa-2x"></span></button>
<h4 class="modal-title">TITLE</h4>
</div>
<div class="modal-body">
<p>BODY TEXT</p>
</div>
</div>
</div>
</div> |
so .. this does not work :/
any suggestion ?
By the way I include jQuery and bootstrap (tested and it works) :
[/code]
<link rel="stylesheet" href="web/js/bootstrap/dist/css/bootstrap.css" media="screen" />
<script src="web/js/jQuery.js"></script>
[code]
Ty all for any information on my issue !
Meca |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Mon Sep 25, 2017 4:56 pm Post subject: |
|
|
I am not seeing any work for Smarty to do.
So, I think simply:
Use this:
echo _VUES_ . 'header.tpl';
instead of this:
$smarty->display(_VUES_ . 'header.tpl');
Now, if you do actually have some work for Smarty to do, we would want to see a sample of that. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon Sep 25, 2017 7:29 pm Post subject: Re: Using Smarty with Bootstrap |
|
|
Mecadie wrote: | I am able to use the Bootstrap's CSS, it works fine but I'm not able to use the jQuery of bootstrap | How's any of this is relevant to Smarty? Smarty is a PHP templating library. jQuery is a browser JavaScript library. They simply never meet in person. |
|
Back to top |
|
Mecadie Smarty n00b
Joined: 25 Sep 2017 Posts: 2
|
Posted: Tue Sep 26, 2017 7:59 am Post subject: |
|
|
Hello everyone,
Yes I found what was going wrong, and I forgotten to include bootstrap.js, I thought it was smarty who worked wrong (I'm new at developing )
So thanks a lot for your intervention ,
regards
Meca |
|
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
|