PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, February 19, 2022

[FIXED] Dropdown menu not working codeigniter controller

 February 19, 2022     codeigniter, css, dropdown, html     No comments   

Issue

I'm having a small problem with dropdown menu and mine controller, I have on my controller the variable for the dropdown content but it dont show on the webpage only those 3 dont work {$DEN}, {$DPT} and {$DES}

Here is the HMTL

<div class="top-nav">
    <nav class="navbar navbar-default">
        <div class="container">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">Menu                       
            </button>
            <!-- Collect the nav links, forms, and other content for toggling -->
            
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <img src="{$favlogo}" alt="" width="8%" height="auto">
                    <li class="hvr-bounce-to-bottom active">{$homebar}</li>
                    <li class="hvr-bounce-to-bottom">{$aboutUs}</li>
                    <li class="hvr-bounce-to-bottom">{$servicos}</li>
                    <li class="hvr-bounce-to-bottom">{$galeria}</li>
                    <li class="hvr-bounce-to-bottom">{$equipa}</li>
                    <li class="hvr-bounce-to-bottom">{$contactUs}</li>
                    <li class="hvr-bounce-to-bottom">{$user}</li>
                    <li class="hvr-bounce-to-bottom">{$login}</li>
                    <li class="hvr-bounce-to-bottom">{$logout}</li>
                    <li class="hvr-bounce-to-bottom">{$email}</li>
                    <li class="hvr-bounce-to-bottom">{$contacto}</li>
                    <li class="dropdown">
                        <a href="javascript:void(0)" class="dropbtn">Idioma</a>
                        <div class="dropdown-content">
                            {$DEN}
                            {$DPT}
                            {$DES}
                        </div>
                    </li>
                </ul>   
                <div class="clearfix"> </div>
            </div>  
        </div>
    </nav>      
</div>  

And here is the Controller code for this part

        $data['DPT'] = '<a href="'.base_url('index.php/cart/indexPT').'">Português</a>'; 
        $data['DEN'] = '<a href="'.base_url('index.php/cart/indexEN').'">English</a>'; 
        $data['DES'] = '<a href="'.base_url('index.php/cart/indexES').'">Español</a>'; 

                    //------------------ FOOTER              ----------------------
        $data['footercontactUS'] = '<a href="'.base_url('index.php/cart/contactUS').'">Contacte-nos</a>';
        $data['footeraboutUS'] = '<a href="'.base_url('index.php/cart/aboutUS').'">Sobre Nós</a>';
        return $data;

Solution

The easier way is to use the full address to the href.

In your view

<a href="https://www.example.com/index.php/cart/indexPT">Português</a>


Answered By - Ricardo Martins
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing