Feather for Pages

Gravatar samuellittley

  • Posts: 41
  • Topic Created: Sun Jan 8 14:45:02 2012 +0100

How would I go about making a feather behave as a page as opposed to a blog post? is it possible?

I want to create something that lets you add a link which shows up in the page list, for when you use the page list to build the navigation for the site.

Also, can feathers respond to triggers? specifically the head trigger so i can add a meta tag

Gravatar jack

feathers can respond to triggers. As to the page list, I would just modify the main_context in includes/controllers/main.php to have the page list include all pages and feathers of type x, as opposed to modding the feather to work like a page.

Gravatar samuellittley

I honestly have no idea what you mean by that...

is main_context a filter? where does it's code live?

Gravatar jack

whoops. its actually in includes/class/theme.php in the function pages_list. add this on line 53 $posts = Post::find("where" => array("feather" => 'feather_handle')); $pages=array_merge_recursive($pages,$posts); change feather_handle to the handle of your feather. that make sense?

Gravatar samuellittley

  • Posts: 41
  • Created: Mon Jan 16 14:19:38 2012 +0100
  • Updated: Mon Jan 16 14:20:53 2012 +0100
  • Permalink: Feather for Pages

correction to that snippet:

$posts = Post::find(array("where" => array("feather" => 'feather_handle'))); $pages=array_merge_recursive($pages,$posts);

So that puts the feather into the pages list, how would it be removed from the blog?

Also, the problem with this approach, is I can't submit this feather for other people to use...

Gravatar jack

you could submit a theme and a feather and just say you need both. in a theme just put it like this public function main_context($context){ Post::find(array("where" => array("feather" => 'feather_handle'))); $pages=array_merge_recursive($pages,$posts); $context['posts_merge_pages']=$pages; } and then loop through for the page list. not sure what you mean by removing from the blog?

Gravatar samuellittley

  • Posts: 41
  • Created: Mon Jan 16 19:07:23 2012 +0100
  • Updated: Mon Jan 16 19:19:18 2012 +0100
  • Permalink: Feather for Pages

that function goes in the feather right? and then do {% for item in posts_merge_pages %}

And any posts I make which use this feather are still going to show up as part of the display of posts, how would i stop this? Because a feather is a type of post?

Gravatar jack

  • Posts: 59
  • Created: Mon Jan 16 22:19:05 2012 +0100
  • Updated: Mon Jan 16 22:20:32 2012 +0100
  • Permalink: Feather for Pages

okay. this all goes in the feather.php. the bit to get feathers is pretty ugly, but its the only way I could think of to get it.


public function main_context($context){ 
$posts=Post::find(array("where" => array("feather" => 'feather_handle')));                       
$pages=array_merge_recursive($pages,$posts); $context['posts_merge_pages']=$pages;
$current=new Paginator(Post::find(array("placeholders" => false)), Config::current->feed_items);
$context['posts']=array_diff($current,$posts); 
return $context;
}