Interesting problem..

7 posts by 2 authors in: Forums > CMS Builder
Last Post: August 11, 2009   (RSS)

By northernpenguin - August 10, 2009

I am having an interesting little problem that I need help with. I have a website which manages case studies, something similar to Article Manager, but written using php and CMSB.

The site is setup such that each article can have multiple categories. When a user searches by category, the articles that meet the search criteria are listed in the case_study.php file. If a user wants to see details of a case study, they select it and it is displayed by case_study_details.php.

The problem arises when a user uses the "back to list page" link. It goes back to the list page, but show all the articles instead of returning to the article it was sent by.

How can I get the detail page to return to the original article? I have attached the 2 files in question.

You can see the site @ http://www.penguinhome.ca/ipac.

Thanx!
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [northernpenguin] Interesting problem..

By Chris - August 10, 2009

Hi northernpenguin,

If your articles belonged to a single category each, then you'd simply need to append ?categories=<?php echo $record['category']?> to your list page link. The way I see things, there are three choices for how to deal with "back to list" links for articles with multiple categories:

1. One link per category which the article belongs to. (e.g. See more Environment articles. See more International articles.)

2. Simulate the browser's back button with JavaScript. While this design decision is quite popular, consider what would happen to a visitor who arrived at your article directly (via Google search results or a link from an email.)

3. Remember which category the visitor was browsing and create a link for just that category (e.g. using the query string). Consider again what link should appear for a visitor who arrived at your article directly -- should they see a link back to the same category that their search engine or friend just happened to use to arrive at the article originally?

I think the first solution is probably the best, if you don't mind multiple links on articles which belong to multiple categories.

Let us know which approach you'd like to take and we can show you how to accomplish it.
All the best,
Chris

Re: [chris] Interesting problem..

By northernpenguin - August 10, 2009

Chris: thanx for the prompt reply. I am using multiple categories (depends upon the article), so your single category option would probably not work.

Option 1 would list all the articles with that category, which is not really what my client wants.

Options 2 is not what I want either.

Option 3 is really the closest, except instead of using the category, is there a way of actually capturing the specific article chosen in case_study.php? That would get me back to the "parent" article, which is where my client wants to be.
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [northernpenguin] Interesting problem..

By Chris - August 10, 2009

Hi northernpenguin,

I must be confused about what you want to accomplish. Can you explain to me exactly what you want your visitor to see after clicking "back to list page"?
All the best,
Chris

Re: [chris] Interesting problem..

By northernpenguin - August 10, 2009

Chris: ok, real example...

Let say I pick the category "International" from http://www.penguinhome.ca/ipac. There are two articles that meet that category. Lets say I choose the first one and press "more..." to see the detail page (http://penguinhome.ca/ipac/case_study_details.php?Dreaming-Big-Implementing-Not-So-Big-Development-Coordination-in-Jordan-s-Ministry-of-Labour-4).

When I select the "back to list page", I end up at http://www.penguinhome.ca/ipac/case_study.php which list all the articles in sort order.

My client would prefer to return to http://www.penguinhome.ca/ipac/case_study.php?categories=International.

I hope that explains it.

Hmmm, now that I think about it, this may actually be your option 3.... sorry, I've been up about 30 hrs and my eyes are getting fuzzy!
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [northernpenguin] Interesting problem..

By Chris - August 11, 2009

Hi northernpenguin,

All three options I listed will get your visitor back to case_study.php?categories=International from a case_study_detail.php article.

Why not try out the first option to see if you like it, as it's the most straightforward.

In your case_study_detail.php file, replace this line:

<a href="<?php echo $ipac_articlesMetaData['_listPage']; ?>">&lt;&lt; Back to list page</a> -

with this:

<?php foreach (getListLabels('ipac_articles', 'categories', $ipac_articlesRecord['categories']) as $category): ?>
<a href="<?php echo $ipac_articlesMetaData['_listPage']; ?>?categories=<?php echo $category ?>">&lt;&lt; Back to list of <?php echo $category ?> case studies</a><br />
<?php endforeach; ?>


Let us know how it goes! :D
All the best,
Chris