8 Posts
JMG
8 years ago
22
Topic

What I wanted to do:

  • Have a list of Seblod articles generated via a Seblod list/search type.
  • After clicking on a Seblod article from the list:
  • Navigate between articles using next and previous links to other articles in the list.
    Pretty much how Joomla's blog category menu list allows you to do.

I cannot use the Joomla blog category because I need Seblod's custom list layout.
I've seen that solution on other post here but that is not what I need.

Is there a query string that I can use to create for button to accomplish this?

I know I can create field to manual set a next/previous links for each article, but given there is over 170 articles (and growing) to deal with that would defeat the purpose of using a CMS/CCK.

The articles are a list of article ins a category listed alphabetical, so using sequential article ID numbers won't work.

I'm NOT concerned about pagination in the list view.
I'm only concerned about navigating between articles within the articles themselves.


I don't mind paying for a pay plugin either (e.g Button Free) but I believe I'd still need the query to pull that off.

Any help or pointers to some documentation on this would be much appropriated.
I've search the forms, documentation and plugins but I don't see anything that can do this.

Thanks so much, great CCK. I really think it is superior to the other Joomla ones out there for what I do.

Get a VIP membership
178 Posts
Jeka
8 years ago
0
Level 1

Hi.

I dont know is it good or bad way but i see the next solution.

You can create list and search type with limitation to show only 1 item.

In this way you can control by which criteria you next or previous item will be defined.

What you think about that? 

Jeka

8 Posts
JMG
8 years ago
0
Level 1

I understand your idea but what do you set the Search Form criteria to?
That is how can I tell which article to search for?

It also assume that is there is one search result, it goes directly to that article.
I've never tried that with Seblod, is that be behavior? I've used over software that is the case but it isn't the norm.

8 Posts
JMG
8 years ago
6
Level 1

Imperfect solution: Add a hidden menu item for a Category Blog. Set the sort order as you see fit and then automatically any content/article view from the Seblod list inherits the next/previous from it.

Normally this might be fine, but I'm sorting in my seblod list by alias (because alphabetical is spoiled by "the" in some of titles).

So it is "close" but not in the same order as my seblod list order.

I hope some day that this gets integrated into seblod list. It is apparent from other posts in the forum that it is desired.

8 years ago
5
Level 2

Hi JMG,

To follow the vision of Jeka with the search list you can use this plugin to generate next and previous button http://www.seblod.com/products/8077

Thanks.

8 Posts
JMG
8 years ago
4
Level 3

Far as I can read, that only displays on the search results. I'm wanting a next/previous on the cck article itself after coming to it from the search results. The goal is to between the various article in the search results without returning to the search results. Article to Article.

8 years ago
3
Level 4

Yes JMG but the content link from your first search can redirect to the second search with limit to 1 and next/previous.

The issue here is about SEO/link and to have not multiple link to the same content. If it's not issue for you (intranet, extranet) you can apply this solution or the one that you already applied (with category view and native joomla previous/next feature).

About alphabetical order you can always add another field to select the right letter you wish to classify your content and order the list in regards of this field.

8 Posts
JMG
8 years ago
2
Level 5

Ok good to know. Unfortunately SEO/link is critical on this public site so that would be a bad idea.

As noted, I'm already sorting my Seblod sort list by "alias" but the Joomla blog sort doesn't offer that option.
Thus why my next/previous are not in the same order as the Seblod search.

Short of a Joomla core hack (wish to avoid), I don't see a work around in my current solution.
Like I said, what I have is an imperfect solution but is close enough.

8 years ago
1
Level 6

The best choice is to use 2 SEBLOD lists. But it's more complicated, it's true.

To avoid the duplicate content you will need to used canonical metadata (see the canonical plugin).

All routing/SEF matter are not obvious, if you need our pro assistance you can subscribe to a support package on seblod.com (see enterprise).

Thanks

8 Posts
JMG
8 years ago
0
Level 7

I have canonical via sh404sef (which I have working very well with Seblod) so I think that should be taken care of.

I'll play around with the two search lists to see if I can get it work.

I'm just not 100% clear on is the second search.

I get that the link from the 1st search to 2nd search targets the item clicked on

Then the 2nd search is limited to 1 item which then auto redirects redirects to that item.

But where is that 2nd search results picking up the IDs for next/previous from the first search?

I'm sure I can play around with it and get it, but given I've seen this same question before here it might be helpful to outline that part of it in this particular context.

Thanks.

40 Posts
yoyoxp
7 years ago
2
Level 1

Has anybody managed to get this scenario working? I have tried:

1.) Creating a new list for pagination purposes with the Seblod Search Pagination field

2.) Created "list" module assigning new pagination list taking in article ID parameter which will be used to base the prev/next resources on

3.) Assigned List module below my main search & list menu item via Module field

When I call the page I currently get the selected item displayed in the list, but the Pagination Next/Previous buttons don't display. Actually the only way I can get them to display is using a menu item and "Search and List" but even then during my tests they don't work (direct only to the homepage which has no content currently). 

I'm guessing here the Search Pagination field does not work under List module, is this correct? If it is is there any alternative to this problem? I have maybe 300+ items and hard coding this would be tedious and really go against the reasoning for using CMS as JMG stated.

If you need any more information do let me know. I am a newbie to Seblod so maybe I'm missing something really simple here?

4229 Posts
Kadministrator
7 years ago
1
Level 2

Pagination is currenlty disabled in module, neither using field or list setting. Additional problem with field is that this field is form field and form is not shown in list module.

One way to work around this would be to display all items (if there is a reasonable amount of them), then limit their display with javascript

40 Posts
yoyoxp
7 years ago
0
Level 3

Cheers Klas,

Would this be a feature you would ever consider as core Joomla offers same? There would be about 400~ items so I don't think showing all and JS to hide is an option for me. I will work around it, manually linking but it is not really efficient at all. Fortunately I don't need to offer the user choice for ordering!

I notice Bes above states:

"best choice is to use 2 SEBLOD lists. But it's more complicated, it's true."

I'm not sure I understand what is meant by this statement, or how it would work in a scenario where the pagination prev/next will appear under content view?

Thanks,

Nick

1283 Posts
Bucklash
7 years ago
1
Level 1

Hello

Sorry to intrude... is this method feasible?

Have a free text field that displays a button with text based on the result of a sql query:

ie do the query of getting all relevant articles. Order them. get the id of the article after the id of current article. Append a link string with this id... display as 'next' button.

40 Posts
yoyoxp
7 years ago
0
Level 2

Hi Bucklash,

This sounds like a great simple approach to this problem which I think would work very well. I will definitely try it out! Cheers for the tip! :)

Nick

1283 Posts
Bucklash
7 years ago
2
Level 1

Hi

Nice :)

Be great to see what code you end up writing...

I think I would do it all in a beforerender field....

4229 Posts
Kadministrator
7 years ago
1
Level 2

I'm puzzled now, whether the issue here is as original topic of this thread (buttons to move between the articles) or to show previous/next buttons for pagination (e.g. to get next 10 or 50 articles), this 2 are completely different things.

40 Posts
yoyoxp
7 years ago
0
Level 3

Hi Klas,

I think the confusion initially is regarding the op title and the Search Pagination field that was brought up. I do not want to change my blog "list" view pagination from numeric to instead "previous/next" page. My requirement is under the item/content view to have a previous/next item. 

I should be able to achieve same with a simple SQL statement and I will look into this when I have some time. It is not pagination I require, or the original poster. Simply when a user accesses an article from a list or blog layout, the "content" view, we would like previous/next buttons appearing.

40 Posts
yoyoxp
7 years ago
2
Level 1

Hi all,

I decided the easiest way to resolve this issue is via SQL query in combination with "Code Pack (5 plug-ins)" I purchased. I created a SQL Query which will be suitable for my requirements, it is:

"$db = JFactory::getDbo();

$query = $db->getQuery(true);

$query
->select(array('a.title', 'a.id', 'a.catid', 'b.ccard_cardno'))
->from($db->quoteName('#__content', 'a'))
->join('INNER', $db->quoteName('#__cck_store_form_callcard', 'b') . ' ON (' . $db->quoteName('a.id') . ' = ' . $db->quoteName('b.id') . ') ')
->where($db->quoteName('a.catid') .' = (\''.$cck->getValue('art_catid').'\')' .' AND '. $db->quoteName('b.ccard_cardno') .' > (\''.$cck->getValue('ccard_cardno').'\')' )
->order($db->quoteName('b.ccard_cardno') . ' LIMIT 1');

$db->setQuery($query);

$results = $db->loadObjectList();

foreach($results as $row) {
$call_id=$row->id;
$call_catid=$row->catid;
}
if($call_id&&$call_catid!=null){
echo '<a href="'.JURI::current().'?option=com_content&view=article&id='.$call_id.'&catid='.$call_catid.'&Itemid=272">Next callcard</a>';
}
else{
echo '<a href="#">Next Callcard</a>';
}"

This does work good, but when I substitute my test values for $cck->getValue('art_catid') and $cck->getValue('ccard_cardno') I get a fatal error! "Call to a member function getValue() on null".

I have checked my Search & List form and both properties referenced are there as hidden values.

How do I resolve this error? As mentioned previously this is not a pagination issue, I need users to be able to go back and forward
under the content view.

1283 Posts
Bucklash
7 years ago
1
Level 2

Hi

just a thought:

what happens if you first place $cck->getValue .... in a variable and then use that variable?

i

40 Posts
yoyoxp
7 years ago
0
Level 3

Simply stating "$cck->getValue('art_catid');" under "Content" view results in this error, it does not occur in Search view. Under List & Search Item view it also throws the same error.

Nick

40 Posts
yoyoxp
7 years ago
0
Level 1

I managed to get the concept of this working by appending all the required properties (ID of category, item etc.) to the URL under my Bootstrap button (simple anchor link with btn class). 

This works fine until SEF urls are activated and then obviously the URL parameters are no longer available or accessible (except for my custom one). 

My question is how is it possible to collect this datas from the seblod database using before render field under the content view? Because I've tried many methods and couldn't get any to work! Once I do this I can easily construct my SQL query to do the logic.

Here is the code for those interested:

http://pastebin.com/XK4fnFcv

40 Posts
yoyoxp
7 years ago
0
Level 1

Right, I finally managed to get this problem sorted (even if in a roundabout way). I will share more detailed explanation if interested however here is what I did in a nutshell. Under Search and List form, where my content was linked to under the Item view, I edited the link properties to include a custom variable:

myvar=$cck->getValue('custom id value'). This ID will be used in the ordering of the items, and also is unique to identify the item.

Now when we call the link to the content page, an additional GET request value will be in the URL, &myvar=<content>. We can use this to build our query..

Using the custom php code in beforerender field I took this value using $_GET[''];, and from this value was able to construct my SQL query to locate the next and previous object in SQL query.

I then used JRoute::_() to build my prev/next button links, to retain the SEF URLs for SEO reasons. 

One of the downsides to this workaround is a new GET variable must exist under the page in order for it to work. This is because we cannot seem to be able to get content value using beforerender in the content view i.e: $cck->getValue() (and before and after store do not support the content view as per documentation). Maybe this is by design, a bug or? I'm not too sure.

Another problem with this method is accessing the item directly without the GET data, maybe even the item from a search engine, you won't get the prev/next buttons unless you access the same or another item from the search and list object. but for now it will do the job for my purpose.

Thanks everyone for their help here,

Nick

Get a Book for SEBLOD