Search code examples
phpjquerycodeignitertooltip

Tooltip not functioning when routed to a new url path


I have template php files for dates and sharing. 1 file is like this:

date-share.php:

<div class="date"><?php echo date('M d'); ?><span><?php echo date('Y'); ?></span></div>
                            <a href="javascript:void(0);" class="share-button"><span class="plus"></span>Share</a>
                            <!-- Tooltip -->
                            <div class="tooltip-social-network clearfix" style="margin-top: -10px">

                                <span class='st_facebook_large' displayText='Facebook'></span>
                                <span class='st_twitter_large' displayText='Tweet'></span>
                                <span class='st_googleplus_large' displayText='Google +'></span>
                                <span class='st_pinterest_large' displayText='Pinterest'></span>
                                <span class='st_instagram_large' displayText='Instagram Badge' st_username='mews'></span>
                                <span class='st_email_large' displayText='Email'></span>
                            </div>

I php include it to one of my views to avoid too much clutter, instead of putting it there.

<?php include('templates/date-share.php')?>

This is how it would look like in the view when the SHARE button is clicked.

enter image description here

The social media icons group is just a tooltip.

However, I rerouted the view to a new url path. So I added a PHP echo base_url to all the links to maintain the root path. But I'm not sure how to apply with the php include, so I didn't add any. It still appeared but the share button can't show the tooltip anymore.

Edit: added pic for clicked SHARE without the tooltip - rerouted to a different url path

enter image description here


Solution

  • You can use view method inside view to load other view/partials.

    Make sure your date-share.php under following path `application/views/template/date-share.php'

    Now inside your main view load your date-share.php as below.

    $this->load->view('template/date-share.php');