I'm have a problem and I don't really know how to fix it. I'm trying to style the Tabs above my forum made with Drupal(see picture)
For some reason it always renders the tabs like on the picture. This is because I'm using the render function (print render($tabs)). I don't know how to get the names of the tabs. They are in a Array called $tabs, but this array returns this(See picture)
Here is everything summarized:
I want to design Drupal's default tabs, but there is one problem, I can't get the names of the tabs without using print render($tabs). But this function already styles the tabs.
Current code:
<?php if ($tabs): ?>
<ul class="nav nav-pills nav-justified">
<li class="active"><?php print_r render($tabs);?></li>
</ul>
<?php endif ?>
EDIT
When you click the tab, it has to redict to a URL. with the render function, it does this automatically. Is it also possible to do this?
Related
I have a very specific problem with the layout
Iam using the PHP, MVC CodeIgniter framework
I have a home page layout where there is left navigation withe following links with fade-in and fade-out effect.
Iam loading all the data from a home controller for these menus. All the data is from a single table
except for current_affairs which Iam loading it as a separate partial or html
Followin is the code snippet I have.
<div class="parrent pull-left">
<ul class="nav nav-tabs nav-stacked">
<li class="active"><a href="#home" data-toggle="tab"class="analistic><a></li> </ul>
</div>
<div class="tab-pane fade" id="home1">
<p><?php echo $result -> home1?></p>
<p><?php =current_affairs ?></p>
</div>
Now Iam adding another new page which is the "local_news" page which will be from another method in the same controller
I need the same left navigation in here as well. But the body content is different here. In that case if have a separate view
for local_news and load both of them they are loading one after the other. which is not correct.
Is there a way to display local news just like home,about ie, within the nav
Any help on this would be highly appreciated. Thanks in advance.
I think you have already discovered that you are loading the same thing twice. In local news just load the content instead of the whole page. Moreover, Its not clear what you are doing in the controller. But "YES" there are many ways to solve the problem. The way to follow is depended on the way you are organizing your things.
I'm working on a scrollable one-page website, in which each div represents a different section. For example, url is dynaone.com/index.php, and when I click on the menu's different buttons, it changes to /index.php#s1, #s2, #s3, and so on. In section nº 2 I added another menu that works with php GET, in a way that when you click on one of the buttons, it redirects you to index.php?id=1 and so on. Of course when I first tried it, it scrolled me back to the top of the page, 'home', as I wasn't specifying the section. But when I did, assigning "index.php?id=1#s2" to the first element in the inner menu, it redirected me to section 1. It doesn't matter which number I write after "#s", it will keep putting section nº 1 on top of the page.
I'm using SMINT's demo as a base, adjusting it to my website's needs, but I couldn't find anything related to GET method issues on the plugin's page.
I would really appreciate some help with this, as it's very annoying having to go back everytime I click to correctly view section nº 2.
This is part of my inner menu:
<div id="botonera_productos"><ul>
<li> Quemadores </li>
<li> BCAAs</li> </ul> </div>
This is my php section:
if(#$_GET['id']==1) {
?>
<figure><img src="imagenes/quemadores/1.jpg"><figcaption> ULTIMATE L-CARNITINA 500 60 TABS - <b>$330</b> </figcaption></figure>
<?php } ?>
And this is the site's main menu:
<nav class="subMenu" >
<div class="inner">
Home
Nosotros
Productos
Local
Envíos
Consultas
Facebook
</div>
</nav>
Thank you.
The question isn't very clear but basically:
The anchor is an HTML construct. So once the page is already loaded, you can use #whatever to take you to wherever on that page that the anchor has been defined; ala <a id="whatever">
The PHP arguments, like ?id=1 - a new page will be loaded depending on what you use here.
You can use anchors in conjunction with a PHP page (ie. a PHP page may have multiple anchors) but you cannot load a new page with anchors alone.
Maybe Javascript will help you achieve what you want to do. With AJAX calls and the like then there are far less restrictions on how you load data.
Currently for my projects I create the navigation for each page manually and it looks something similar to:
<nav>
<ul id="mainMenu"><!--Main Menu-->
<li><a class="active" href="index.php">Home</a></li>
<li>Contact</li>
</ul>
</nav>
This works fine, however for projects that has many many pages it is not a really good practice or even efficient to do it manually. So I was wondering if there is anyone who can direct me to the right path and advice me on how to make my navigation dynamic? I know about PHP include and the .inc files - they are good. BUT I want to add class .active to the <a> of the page that is currently open. How can I do that?
BTW: I don't know if this s the right place to post this sort of questions here, but the moderator told me to post it here.
Use include to add a central php file, that contains a function which can take the current page as a parameter:
nav.inc:
function renderNavigation($current_page) {
//render you navigation
}
main.php:
require_once("nav.inc");
renderNavigation("Subpage 1")
I wish to be able to open page on a specific tab by sending a message via GET variable. I was thinking something like:
http://mydomain/mytimecards.php?tab=vte
Here is the code for the jQuery tabs:
<div id="tabs">
<ul>
<li>Submit Time Cards</li>
<li>View Time Entries</li>
</ul>
<div id="mytimecards">
etc ....
Is it possible to force the page to display the 2nd tab (#timecardReports) instead of the first ONLY IF ?tab=vte is received as a GET (or better yet POST) variable?
Assuming the plugin you are using allows you to set an active tab on load, you could do something like:
<li><a href="#timecardReports" id="vte" <? if(isset($_GET['tab']) && $_GET['tab'] == 'vte'){ echo 'class="active"'; } ?>>View Time Entries</a></li>
Replacing class="active" with whatever the plugin requires you to set.
Thanks, guys, Ben and itachi were onto the right solution. This worked:
http://mydomain.com/mytimecards.php?tab=vte#timecardReports
I found this by using firebug and watching what changed as the tabs were clicked. Thanks itachi.
Ben's suggestion enabled me to test for this condition and set it on page load.
Credit to them both.
I've been looking around for some guide that could tell me how to make an existing menu editable when added in Concrete 5.
Here's the menu I'm using now, I'd like to be able to edit it in c5:
<div class="menu">
<ul>
<li><span>Hem</span></li>
<li><span>Om oss</span></li>
<li><span>Tjänster</span></li>
<li><span>Referenser</span></li>
<li><span> Kontakt</span></li>
</ul>
</div>
The links doesn't work at all in c5, so if anyone could help me a little that would be greatly appreciated!
Thanks!
One of the nice benefits of using any CMS is that it will automatically create the nav menu for you -- so that when users add new pages they automatically show up in the menu.
In Concrete5 specifically, the way you do this is with the "AutoNav" block. As with any block, this can be added to areas on your page, but since you generally want the nav menu to appear on EVERY page in the same place, you can also add the block directly in your template code.
So, for your menu (which is a one-level menu without a dropdown), replace your nav menu html with this code:
<?php
$nav = BlockType::getByHandle('autonav');
$nav->controller->orderBy = 'display_asc';
$nav->controller->displayPages = 'top';
$nav->controller->displaySubPages = 'none';
$nav->render('templates/header_menu');
?>
Now you will need to make a change to your CSS, because that code will generate HTML that is slightly different than what you have -- it looks more like this:
<ul class="nav-header">
<li>Hem</li>
<li>Om oss</li>
<li>Tjänster</li>
<li>Referenser</li>
<li>Kontakt</li>
</ul>
The differences are that there's no surrounding div (although you could leave that if you wanted by surrounding the php code above in the opening and closing div tags), there's no span around the nav items, and the class for a selected item is "nav-selected" instead of "current".