Expression Engine 3 pagination with page_uri - php

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

Related

Why are custom Breadcrumb links all going to index page even though the href string seems correct?

I'm trying to generate custom Breadcrumbs in a SilverStripe app and I can't figure out why the links are not working. The HTML code in page source appears to be what I want and if I click on a link from the elements section of Safari's webpage inspector, I can land on the correct page. However, when I hover over the link or click on any of my Breadcrumb links in the browser page, I always see localhost and get directed to the homepage. Any ideas how to fix this?
Here's some relevant code
My template, Breadcrumbs.ss:
<% loop $MyBreadcrumbs %>
/ $name
<% end_loop %>
The code below is HTML copied from Page Source. The links from this section all go to the root page, “/“, instead of, for example, "/resources/links/"
<div id="Breadcrumbs" class="grid_9 alpha">
/ Home
/ Links
</div>
The links below all work and are generated using the $Link SilverStripe common variable:
<div class="row">
<aside class="col-3 col-md-3 d-none d-md-block d-print-none">
<ul class="aside__nav">
<li>
Links
</li>
</ul>
</aside>
</div>

PHP CodeIgniter layout Issue

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.

# Anchor not working with php "id"

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.

Remove heading from Superfish Menu Drupal 7

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/

modify wordpress wp_nav_menu url

How could I change the code generated by wp_nav_menu?
Right now it generates:
<ul class="rounded ">
<li class="arrow">Menus</li>
</ul>
I'd like it to look like this:
<ul class="rounded ">
<li class="arrow">Menus</li>
</ul>
i found this link, but could not get it working properly.
http://wordpress.org/support/topic/how-do-i-modify-wp_nav_menu-link-hrefs?replies=2
The link from support forum doesn't talk about the version number of the wordpress that he is using. I am currently on 3.2.1, it is having the menu options under Appearance section. You can check out this awesome post on menus. It gives you an option of modifying the href as well.
I hope you are on version > 3. If not possible to update then it has to be done using wp functions.

Categories