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

Using Smarty with Bootstrap

 
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 -> Smarty 3
View previous topic :: View next topic  
Author Message
Mecadie
Smarty n00b


Joined: 25 Sep 2017
Posts: 2

PostPosted: Mon Sep 25, 2017 10:35 am    Post subject: Using Smarty with Bootstrap Reply with quote

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 Embarassed

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
View user's profile Send private message
bsmither
Smarty Elite


Joined: 20 Dec 2011
Posts: 322
Location: West Coast

PostPosted: Mon Sep 25, 2017 4:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Sep 25, 2017 7:29 pm    Post subject: Re: Using Smarty with Bootstrap Reply with quote

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
View user's profile Send private message
Mecadie
Smarty n00b


Joined: 25 Sep 2017
Posts: 2

PostPosted: Tue Sep 26, 2017 7:59 am    Post subject: Reply with quote

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 Embarassed )

So thanks a lot for your intervention ,

regards

Meca
Back to top
View user's profile Send private message
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 -> Smarty 3 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