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.
Related
I have looked for a while for a solution to this, but have been unsuccessful so far. Not sure if it's me, or if there's a problem with the pagination functionality.
What I'm trying to do
When on a page within a certain channel, I want to have 'prev' and 'next' buttons to click through to the next article in the channel. These links must use the page_uri set for each page.
What I've tried
I have a channel full of pages. In the template, I have added:
{exp:channel:entries channel="project" dynamic="no" orderby="date" sort="desc" limit="1" paginate="bottom"}
<div class="container-fluid project-section pagination-bar">
<div class="container">
<div class="col-md-12">
{paginate}
{pagination_links}
<ul>
{previous_page}
<li>Previous Page</li>
{/previous_page}
{next_page}
<li>Next Page</li>
{/next_page}
</ul>
{/pagination_links}
{/paginate}
</div>
</div>
</div>
{/exp:channel:entries}
This is adding the links to the bottom of the page, but when clicking on them the URLs are just loading the same URL you're currently on, then adding /P1 to the end.
I need it to use the page_uri added in the CMS so that it clicks through properly and doesn't affect SEO on the site.
Any help appreciated on this one, thanks
Pagination isn't really the way around this. You should look into Next/Previous Entry Linking. It'll give you a full link to the previous and next entry. Just make sure to keep it outside your channel entries loop.
For example you'd want something like:
{exp:channel:prev_entry channel="project"}
View previous project
{/exp:channel:prev_entry}
{exp:channel:next_entry channel="project"}
View next project
{/exp:channel:next_entry}
Assuming your projects all live in a section called projects you'd be linking between
/projects/example-project-1
/projects/example-project-2
/projects/example-project-3
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.
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?
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'm working with Drupal for the first time, and have been able to find answers for all of my other questions, so far, on either Drupal's forms or via other means. However, I can't seem to find a way to remove the "Main Menu" header from my superfish menu.
I've created a region called superfish and added superfish to it successfully. But above the menu there is an Main Menu that I would like to remove. There doesn't seem to be a way to do this from the superfish options, and i can't seem to find where in the code this is being appended, or else I would just comment out that line. I've searched in the superfish.js file as well as the 'superfish.module` file and can't seem to find it. I'm a programmer first and a 'web designer' second, so getting my hands dirty in some code is not a problem, in fact, I would prefer to do it that way.
Has anyone else done this? Or know where I should start to look?
This is the html that is generated at runtime:
<div id="superfish">
<div class="region region-superfish">
<div id="block-superfish-1" class="block block-superfish contextual-links-region">
<h2>Main menu</h2>
<div class="contextual-links-wrapper contextual-links-processed">
<div class="content">
<ul id="superfish-1" class="menu sf-menu sf-main-menu sf-horizontal sf-style-simple sf-total-items-2 sf-parent-items-1 sf-single-items-1 superfish-processed sf-js-enabled sf-shadow">
<li id="menu-221-1" class="active-trail first odd sf-item-1 sf-depth-1 sf-no-children">
<li id="menu-312-1" class="active-trail last even sf-item-2 sf-depth-1 sf-total-children-1 sf-parent-children-0 sf-single-children-1 menuparent">
</ul>
</div>
</div>
</div>
Thanks!
I stumbled across the real answer... Isn't it funny that one tends to figure things out when they stop thinking about them?
The main menu header was the block title, when editing the superfish block the very first field is Block Title this allows one to override the default setting of the block title. By placing <none> in this field, the block title is no longer displayed.
Apart from finding where that HTML is output, which is the ideal solution, you could use jquery after the fact to remove the title.
$('#superfish h2').html('');
jsfiddle here: http://jsfiddle.net/DetEb/