Code Monkey home page Code Monkey logo

structure-channel's Introduction

#Structure Channel

Version 1.0.2

  • Requires: ExpressionEngine 2.4+

  • Optional: Structure module

Description

Structure Channel is a drop-in replacement for the Channel module which generates query string pagination (?p=1) rather than using URI segments /P1/

Why on earth would you want to do this?

If you are using Structure or the Pages module with Freebie or .htaccess mod_rewrite rules to create custom URLs, then you will quickly find that the native pagination doesn't work.

Installation

  1. Copy the folder structure_channel to ./system/expressionengine/third_party/
  2. In the Control Panel, go to Add-Ons > Modules and click the Install link for Structure Channel

Parameters

Exactly the same as the Channel module, with one additional (optional) parameter:

pagination_param = ""

This determines the parameter name used in the pagination query string. By default this is 'p'.

Sample usage

{exp:structure_channel:entries 
	channel="my_channel" 
	disable="member_data|categories" 
	dynamic="no" 
	limit="10" 
	paginate="bottom" 
	paginate_base="/my/custom/uri/?" 
	pagination_param="page"
}

	{title} <br />

	{paginate} 
		<p>Page {current_page} of {total_pages}</p>
	
		<p>{pagination_links}</p>
	
		{if previous_page}
		<a href="{auto_path}">Previous Page</a> &nbsp;
		{/if}

		{if next_page}
		<a href="{auto_path}">Next Page</a>
		{/if}	
	{/paginate}	

	{if no_results}
		Sorry, no entries were found.
	{/if}
{/exp:structure_channel:entries}

structure-channel's People

Contributors

croxton avatar

Stargazers

 avatar Tim Kelty avatar Fred Carlsen avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

timkelty

structure-channel's Issues

Idea: expand scope and deprecate "Stucture Entries" plugin

Right now this add-on's use is really restricted to just the pagination tweaks.

What I would like to see is a replacement for "Stucture Entries". This is a plugin I HATE using, but when I have to do something really custom with the Structure tree, sometimes I have to turn to it.
http://devot-ee.com/add-ons/structure-entries

Now that we can use the Channel entries model in EE2, it seems like recreating a lot of what it does would be relatively easy.

Essentially, you'd need to register a handful of vars for depth, has_children, etc, and then set the order based traversing down the Structure tree. You'd probably also need an additional param for start_from or parent.

Thoughts? Do you think this is right place something like this?
Is this anything you'd interested in working on, or should I fork and give it a shot?

Suggestion: append to rather than overwrite query string

This is a a great plugin - makes so much more sense to take this approach than the way the standard structure pagination works. But both this and the structure-bundled approach both nuke any query strings in the URL when appending the pagination parameter. I'd be nice if the query string could be left intact and the pagination parameter appended instead.

The reason i'd like this is that I'm implementing a (fairly hacky, it has to be said!) dynamic entries filter using a GET based form and Mo' Variables (http://devot-ee.com/add-ons/mo-variables/) and with persistent query strings then I can paginate my filtered list with this extension.

I've actually currently hacked the plugin to make this work for me - happy to share but it's pretty nasty and I'm sure you can come up with a more elegant way to handle it if you think it's a good idea to include ;-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.