Is there a way of sycnonising two listviews on the same page when using a random() order? The first listview is a JQueryTools slider and the second listview is the sliders navigation.
I assume I can do this with objects but would like to use documents
Thanks in advance,
Michael.
Sycnonising random() order Listviews (resolved)
-
- Senior Member
- Beiträge: 160
- Registriert: Mi 4. Feb 2004, 02:39
- Wohnort: London / UK
- Kontaktdaten:
Sycnonising random() order Listviews (resolved)
Zuletzt geändert von Michael_S am So 22. Mai 2011, 13:50, insgesamt 1-mal geändert.
-
- Senior Member
- Beiträge: 425
- Registriert: Do 1. Jan 1970, 02:00
- Wohnort: Dresden
- Kontaktdaten:
Re: Sycnonising random() order Listviews
You could do this by storing the output of the random listview in a PHP array. Doing this, you can echo your randomized listview as often as you want.
Let me know if you need further assistance.
Regards,
Alex
Let me know if you need further assistance.
Regards,
Alex
http://www.xport.de – Internet-Agentur für Hotels
http://www.domainpreisvergleich.de – Domain-Preisvergleich inkl. Verfügbarkeits-Check – ist meine Wunschdomain noch frei, und wo registriere ich sie am günstigsten?
http://www.domainpreisvergleich.de – Domain-Preisvergleich inkl. Verfügbarkeits-Check – ist meine Wunschdomain noch frei, und wo registriere ich sie am günstigsten?
-
- Senior Member
- Beiträge: 160
- Registriert: Mi 4. Feb 2004, 02:39
- Wohnort: London / UK
- Kontaktdaten:
Re: Sycnonising random() order Listviews
Hi Alex,
That makes sense, I've had a look through the forum but can't find a reference could you help me with a code example. Also would this work with both listview type document and object?
Thanks,
Michael.
That makes sense, I've had a look through the forum but can't find a reference could you help me with a code example. Also would this work with both listview type document and object?
Thanks,
Michael.
-
- Senior Member
- Beiträge: 425
- Registriert: Do 1. Jan 1970, 02:00
- Wohnort: Dresden
- Kontaktdaten:
Re: Sycnonising random() order Listviews
Hi Michael,
it doesn't matter if you use it for a document or object listview.
Try this for storing your listview in an array:
Now you can echo your listview as you like:
I hope that works for you? You could change the listview type to "object" without any changes. The field names "content" and "title" are examples only.
Regards,
Alex
it doesn't matter if you use it for a document or object listview.
Try this for storing your listview in an array:
Code: Alles auswählen
<?php
$myCounter = 0;
?>
<we:listview name="xyz" type="document" order="random()">
<we:repeat>
<?php
$myArray[$myCounter]["title"] = $lv->f("title"); // let's say you have a field "title" in your listview documents
$myArray[$myCounter]["content"] = $lv->f("content"); // let's say you have a field "title" in your listview documents
$myCounter++;
?>
</we:repeat>
</we:listview>
Now you can echo your listview as you like:
Code: Alles auswählen
<?php
foreach ($myArray AS $key => $value) {
echo $value["title"]; // echoes the title field
}
foreach ($myArray AS $key => $value) {
echo $value["content"]; // echoes the content field
}
?>
Regards,
Alex
http://www.xport.de – Internet-Agentur für Hotels
http://www.domainpreisvergleich.de – Domain-Preisvergleich inkl. Verfügbarkeits-Check – ist meine Wunschdomain noch frei, und wo registriere ich sie am günstigsten?
http://www.domainpreisvergleich.de – Domain-Preisvergleich inkl. Verfügbarkeits-Check – ist meine Wunschdomain noch frei, und wo registriere ich sie am günstigsten?
-
- Senior Member
- Beiträge: 160
- Registriert: Mi 4. Feb 2004, 02:39
- Wohnort: London / UK
- Kontaktdaten:
Re: Sycnonising random() order Listviews
Hi Alex,
Thanks that was excelent. For anyone else looking at JQueryTools Scrollable (http://flowplayer.org/tools/index.html) here's the basic working code based on Alex's method to output an Object listview as a scroller with navigation. Alex indicated the same method could be used with a document based listview.
My requirement was to have featured (sticky) posts included in the scroller, for this example the sticky posts are tagged using a checkbox.
1. Include JQuery Tools
2. Zero the counter
3. Set your Listview condition (Blog_Featured = checkbox)
4. Instigate the listview and count the results
5. Output the Listview array for the scroll panels
6. Output the scroll navigation in the same order as the panels
Thanks that was excelent. For anyone else looking at JQueryTools Scrollable (http://flowplayer.org/tools/index.html) here's the basic working code based on Alex's method to output an Object listview as a scroller with navigation. Alex indicated the same method could be used with a document based listview.
My requirement was to have featured (sticky) posts included in the scroller, for this example the sticky posts are tagged using a checkbox.
1. Include JQuery Tools
Code: Alles auswählen
<script src="http://cdn.jquerytools.org/1.2.5/full/jquery.tools.min.js"></script>
Code: Alles auswählen
<?php
$myCounter = 0;
?>
Code: Alles auswählen
<we:condition name="featured">
<we:conditionAdd field="Blog_Featured" value="1" compare="=" />
</we:condition>
Code: Alles auswählen
<we:listview type="object" name="Featured" order="random()" condition="\$featured" classid="2">
<we:repeat>
<?php
$myArray[$myCounter]["WE_ID"] = $lv->f("WE_ID");
$myArray[$myCounter]["Blog_Title"] = $lv->f("Blog_Title");
$myCounter++;
?>
</we:repeat>
</we:listview>
Code: Alles auswählen
<div id="scroll">
<div id="tools">
<?php
foreach ($myArray AS $key => $value) {
echo '<div class="tool" style="background: blue;">';
echo '<div class="content">';
echo '<span class="title">#' . $value["WE_ID"] . ' ' . $value["Blog_Title"] . '</span>';
echo '</div>';
echo '</div>';
}
?>
</div>
</div>
Code: Alles auswählen
<div class="navi">
<?php
foreach ($myArray AS $key => $value) {
echo '<a class="slider_nav">#' . $value["WE_ID"] . ' - ' . $value["Blog_Title"] . '</a>';
}
?>
</div>
Wer ist online?
Mitglieder in diesem Forum: 0 Mitglieder und 6 Gäste