On my latest project with
Seagull PHP Framework i need an own section for every category. With the "normal" method of defining an action for every section i don't have the current category marked as "current" when i view an article. This is a quick tutorial how i solved the problem.
Step 1: don't define an action
In SecitonMgr i don't tell the section which action to use. So i just define:
module = publisher
manager = articleView
parameter = frmCatID/1
for my category 1
Step 2: let the manager decide which action to use
with this simple piece of code in articleViewMgr's validate() method it can automatically decide if we want the category listing (summary) or aritcle view (view) action. The latter only if the article Id is given:
//magic action
$input->action = ($input->articleID)
? 'view'
: 'summary';
Step 3: modify articleBrowser.html template
In the articleBrowser.html template you again have to delete all references to articleView action in makeUrl() calls, but you also pass the category to the "view" call:
{makeUrl(##,#articleview#,#publisher#,articleList,#frmCatID|catID||frmArticleID|item_id#,key)}
This way sectionMgr defines the section for the current category as current for both urls:
/publisher/articleview/frmCatID/1/ -> summary for category 1
/publisher/articleview/frmCatID/1/frmArticleID/123/ -> view of article 123