This site uses cookies and similar technologies.

If you don't change browser settings, you agree to it.

I understand
43 Posts
Mime
6 years ago
6
Topic

Hi guys,

just a quick question: In my list I am trying to load more items by using ajax. Can somebody provide an example of how you did it? :)


regards,
Mime

Get a Book for SEBLOD
27 Posts
abram
5 years ago
2
Level 1
Hi Mime,

I've the same "problem". Did you find a solution?

THX
abram
43 Posts
Mime
5 years ago
1
Level 2
Hi abram!

Sorry, no. I did not look further into it because I realized it would take quite some understanding to do it manually. I just hoped there was a shortcut through Seblod :)

Let me know if you succeed!
179 Posts
Codigo Aberto
5 years ago
0
Level 3
Need to code for that and use override position width RAW items display for ajax get/show more items.
5 years ago
2
Level 1
Hi

For example we use this technique to display lists within lists:

Let's say you have two lists: List_A and List_B and you want to display list_B within each item of list_A

So in your LIST_A item view you just have three fields:
ART_ID field
a text field nammed 'list_b'
a php before render code field:

// get the id of the current item from list_A
$id = $fields['art_id']->value;
// we build the URL of the type B list filtered according to the A item
// of course it means you already created the list_B with a live value (button (2) ) upon a field that will use one of the url variable (here 'id_a' for the example)
$url = JURI::base().'index.php?option=com_cck&view=list&search=list_b&task=search&tmpl=raw&id_a='.$id;

// we get the content of the url
// and you display it within the text 'list_b' field
$content = file_get_contents($url);
$fields['list_b']->value=$content;

to have the &tmpl=raw working you need to create a raw.php file at the template root folder. This raw.php file should only contains:
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
?>
<jdoc:include type="component" />

cyril
103 Posts
Alain L
4 years ago
1
Level 2

Hello,  thank you very much for this tip.

I tried to follow your instructions but it doesn't work. I think I haven't understood how the raw template works:

If I test this link directly in my browser ($url = JURI::base().'index.php?option=com_cck&view=list&search=list_b&task=search&id_a='.$id ) it displays correctly my list b. But if I add '&tmpl=raw' the page is blank and the content is empty. 

Of course I put the raw.php file in the templateS directory. 

Thank you for your help

103 Posts
Alain L
4 years ago
0
Level 3

OK!   I tried '&tmpl=component' instead of '&tmpl=raw' it works and the raw.php file is not usefull. I haven't understood how it works but it works. Thank you

Get a VIP membership