views:

96

answers:

1

I've got a Graffiti CMS (http://graffiticms.com) questions that is driving me crazy. I figured this would be the best place to try to get an answer and at the same time hopefully provider an answer for someone else with the same issue.

First, I have a site structure like this:

  • Category1
    • Sub-Category1
  • Category2
    • Sub-Category3
    • Sub-Category4
    • ---Post1
    • ---Post2

I have my .view files in the theme. I have a category2.sub-category4.view file which in theory replaces the index.view file displaying the posts within the subcategory with the formatting of my choosing (this part is working).

What isn't working, and I can't figure out is when I go to localhost/category2/sub-category4/post1/ to view the post, it is also using the category2.sub-category4.view to try to display the contents of the post. But since the .view file was setup to display a list of posts it isn't going to display properly. What the expected behavior is for it to use post.view to render the post.

According to http://graffiticms.com/old-support/designers/making-use-of-views/ category2.sub-category4.view should override index.view and it doesn't say anything about it overriding post.view.

I've tried every naming schema I can think of, and if I change the category it always seems to override my post.view as-well. Any help is appreciated.

+2  A: 

In all the views, Graffiti includes a $where variable which contains a flag you could potentially use.

#if($where == 'category')
Your list view
#else
Your post specific view
#endif

Not perfect for sure (I thought this issues had been resolved), but that should help you through this hurdle.

Scott Watermasysk
Thank you Scott. Guess I wasn't going crazy at that moment then.
Jeremy H