solved Subpages in Custom Aparna Modules?

elric
@elric
10 years ago
81 posts
The new version of Aparna is fantastic! I've been looking through for any documentation on how to handle 'sub-pages' using Aparna, and can't find anything...

Example:

1. Created a new module called "News", and the url is mysite.com/news/
2. Created a news_category field in the form designer, and use search1="news_category = Local News" = World News, etc. to group displays on the Jamroom\modules\dnNews\templates\index.tpl

Now, I would like to create sub pages of News, but not sure how to proceed here? In other words, I would like users to be able to click a link for "Local News" and see only Local News stories, with perhaps a URL like mysite.com/news/local using a template like

Local News
{jrCore_list module="dnNews" order_by="_item_id numerical_desc" pagebreak="10" page=$_post.p pager=true search1="news_category = Local News"}


How do we do this with an Aparna created module?

Cheers!
~E
updated by @elric: 09/21/14 10:23:39AM
michael
@michael
10 years ago
7,715 posts
an Aprana created module is the same as a module created from scratch. You can download it to your IDE and build upon it as if you'd created the whole thing.

Take a look in your other modules in the index.php file for functions called view_(module name)_default() for examples.

If you have it, the jrFeed module is a good structure.

function view_jrFeed_default($_post, $_user, $_conf)
{ // do a search for whatever your wanting, perhaps the news category //send those items out to a custom template return jrCore_parse_template('rss.tpl', $_rt, '(your module name here)'); }

So then you can do all your processing in php for whatever you want out to the template.

-----------
Another way to do it would be in the index.tpl file for your module. you can put in a {debug} to see what variable returns 'local' mysite.com/news/local and pass that in to your list function:

{jrCore_list module="dnNews" order_by="_item_id numerical_desc" pagebreak="10" page=$_post.p pager=true search1="news_category = $option"}

or perhaps a check first:
{if strlen($option) > 2}
{jrCore_list module="dnNews" order_by="_item_id numerical_desc" pagebreak="10" page=$_post.p pager=true search1="news_category = $option"}
{else}
{jrCore_list module="dnNews" order_by="_item_id numerical_desc" pagebreak="10" page=$_post.p pager=true}
{/if}

thats a couple of different ways to do it. There might be others but those are the first that spring to mind.
elric
@elric
10 years ago
81 posts
michael:


function view_jrFeed_default($_post, $_user, $_conf)
{ // do a search for whatever your wanting, perhaps the news category //send those items out to a custom template return jrCore_parse_template('rss.tpl', $_rt, '(your module name here)'); }

So then you can do all your processing in php for whatever you want out to the template.

Yup, I have that module, and the URL for my custom module is currently mysite.com/local

I have a custom list template setup for that:


    <div class="block_content">
<h2 class="news_category_title">Local News</h2>
        {jrCore_list module="dnNews" order_by="_item_id numerical_desc" pagebreak="10" page=$_post.p pager=true  search1="news_category = Local News"}
    </div>

    <div class="block_content">
<h2 class="news_category_title">U.S. News</h2>
        {jrCore_list module="dnNews" order_by="_item_id numerical_desc" pagebreak="10" page=$_post.p pager=true  search1="news_category = U.S. News"}
    </div>

    <div class="block_content">
<h2 class="news_category_title">World News</h2>
        {jrCore_list module="dnNews" order_by="_item_id numerical_desc" pagebreak="10" page=$_post.p pager=true  search1="news_category = World News"}
    </div>


This shows 10 most recent stories in each category. I then have a list template for each category: Local News, U.S. News, World News that only shows relevant content. What I'm trying to do is figure out how to set the url for those sub categories - something along the lines of:

mysite.com/news/index.php?news_category=Local News
mysite.com/news/index.php?news_category=U.S. News
mysite.com/news/index.php?news_category=World News

Perhaps I'm looking at the problem from the wrong solution?
elric
@elric
10 years ago
81 posts
In other words, how do I navigate to custom sub template of a module?
michael
@michael
10 years ago
7,715 posts
Here's a video:
Handling sub-urls for modules created via aprana

--update--
Video added to the docs:

"jrAparna"
https://www.jamroom.net/the-jamroom-network/documentation/modules/853/jraparna
updated by @michael: 08/11/14 10:59:28PM
elric
@elric
10 years ago
81 posts
You, sir, are a ninja. THANK YOU. Wish you were local, I would buy the first round of Single Malt.

Cheers,
~E
michael
@michael
10 years ago
7,715 posts
I would enjoy that. :)
elric
@elric
10 years ago
81 posts
As would I! Highland or Islay?
elric
@elric
10 years ago
81 posts
BOTH! This works brilliantly, Michael. You're the bee's knees. Marked this as solved!

Cheers,
~E
michael
@michael
10 years ago
7,715 posts
Not that I'm much of a connoisseur but I like these two:
"The Glenlivet 12year"
http://scotchnoob.com/2010/12/19/the-glenlivet-12-year/

"Wild Turkey 8 year"
http://scotchnoob.com/2011/04/21/wild-turkey-101-bourbon/

And if money wasn't an issue then I'd drink more of:

"The Macallan 12 year"
http://scotchnoob.com/2010/12/27/the-macallan-12-year/
douglas
@douglas
10 years ago
2,790 posts

YUM! :)


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
elric
@elric
10 years ago
81 posts
Macallan! I'm a big fan... ;-) 18 if I can find it!!!

Tags