Codeigniter Controller Issue: Dropdown Menu Malfunction

I'm facing an issue with the dropdown menu and my controller. I have defined variables in my controller for the dropdown content, but they are not displaying on the webpage. The variables {$DEN}, {$DPT}, and {$DES} seem to be causing the problem.

Below is the HTML markup:

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

Here is the relevant section of the Controller code:

        $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;

Answer №1

An efficient method is to utilize the complete URL in the href attribute.

From your perspective

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

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

PHP is not processing the HTML form I submitted

HTML: <form method="post" action="create.php"> Job #: <input type="text" name="jobnum"> <br> Program: <input type="text" name="program"><br /> Ship Date: <input type="text" name="shipdate"><br /> Description: < ...

What could be causing my content to unexpectedly break out of its designated div structure?

My website on Wordpress is causing me trouble. When I input text directly into the HTML/CSS structure hardcoded style, it fits perfectly. However, when I attempt to do the same thing using Wordpress <?php echo the_content();?>, it ends up breaking ou ...

Load website once AJAX has finished

Currently, I am using an ajax call to retrieve the color scheme of my website from the database due to having multiple clients with different schemes. My goal is to ensure that the page only loads after the ajax call has completed. Despite an expected dela ...

The input and label are not experiencing any overflow

I've been following a tutorial to create an animation on an input and label. I successfully did it once today in school, but for some reason, it's not working now. My objective is to have the label inside the "input" field, with the input taking ...

Methods for retrieving the chosen option from a Bootstrap dropdown in Python and Flask

Exploring the realms of Python and Flask programming for website development, I find myself in uncharted territories. Specifically, I am on a quest to capture the value selected from a bootstrap single-button dropdown menu and transfer it into my Python co ...

Using *ngFor in Angular for Parent-Child component interaction

Is there a way to iterate through a child component multiple times with different data each time? For instance, in my 'sitelist' component (parent), I aim to loop through my 'summary' component (child) as many times as needed based on ...

Upon loading, the Carousel is visible instead of being hidden, which is contrary to its intended behavior

Any help would be greatly appreciated as I am struggling with creating a web page featuring tabs for "London, New York, Shanghai". The initial page displayed is the "welcome" page with the other tabs hidden on load. I successfully implemented a carousel f ...

Learn the process of transferring information from an array to a database

Hello fellow developers. I'm currently facing an issue with inserting data into a database using the controller function. Could someone please assist me with this matter? Below is the PHP form snippet I am working with: <form method=&a ...

Verify whether all the elements within a specific div are distinct by utilizing jQuery

I need to create a select box that, when an option is chosen, generates a certain number of textboxes within a div. Currently, there are three fields: display_name[], user_name[], and user_password[] The code for this functionality is as follows: <se ...

CSS - apply unique styles to specific nodes based on the class they share

Struggling to apply different styles to the same class when it appears for the second time in the markup using the Subsequent-sibling combinator "~". It seems like there may be a detail I'm missing with the use of "~". Unfortunately, the HTML cannot b ...

Codeigniter form_validation: Utilizing parameters effectively

I'm currently working on setting up form_1 with form_validation in my CodeIgniter project. The data entered in form1 will be transferred to form_2, which also includes form_validation rules. Below is the controller code snippet: public function reg ...

I am struggling to properly align the login form in the center of the login page

Can someone please assist me in centering the login form on the login page? I've attempted using align-items-center and justify-content-center but it's still aligning at the top. Any help would be greatly appreciated as I've spent a signific ...

How can you create a table cell that is only partially editable while still allowing inline JavaScript functions to work?

Just a few days back, I posted a question similar to this one and received an incredibly helpful response. However, my attempt at creating a table calculator has hit a snag. Each table row in a particular column already has an assigned `id` to transform t ...

When clicking on a video in the array, the next one will play while the index increments

It's a bit confusing... I'm struggling to articulate it properly. The issue I'm having is with a play array function I've implemented. Here's the code snippet: $("#myVid").bind("ended", function() { $("#MyT").fadeIn(25 ...

Using HTML and CSS to implement a broadened perspective for a specific design

https://i.stack.imgur.com/ckQHa.png Hello, I am facing an issue with a UX design that is optimized for 1200px resolution width. However, when the HTML is loaded in a browser on a larger window resolution, there is a 200px gap on the right side. How can I ...

Is there a way to bypass or neglect the row style class within a column?

When I applied rowStyleClass to my DataTable, it was based on the following conditions: <style> .deleted { color: darkgray; text-decoration: line-through; } .normal { } </style> However, I encountered an issue where the last t ...

Delivering individual CSS files instead of grouped together

Is there an efficient way in Phoenix to serve the CSS file individually instead of combining them? I find it inefficient to send all the unnecessary CSS code from other pages when only one page is being viewed. This can also result in style conflicts if no ...

Show an error notification if the mobile device does not meet the requirements for jquery mobile version

Currently, I am in the process of creating a website using HTML5, CSS3, and jquerymobile. My goal is to have an error message appear saying "Your mobile browser does not support this application" if the page is not rendering correctly or if the jquery mobi ...

Samsung S4 Android device experiencing interruption in HTML5 video playback

When using Android Webview to play html5 videos, including Youtube videos (using my own tags and Youtube embedded iFrames), I came across an issue with the Samsung Galaxy S4. The problem occurs in the following scenario: Play a video. Press 'back&ap ...

ObtainComputedStyle yields surprising CSS properties

Can anyone help me figure out why I'm not able to access a CSS rule's value correctly using getComputedStyle? Here's what I'm dealing with: background: linear-gradient(to right, red , yellow); However, the result I'm getting is d ...