Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Randomize i18n Search Results?
#1
I am currently using the i18 suite of plug ins and have it all working except the client requires the results of the page show the content randomly for every user. That way no one company is always on the top of the page when the results are displayed.

I found a random content script that uses a class="group1" to reorder content. I have already added it to the page and template for the page, but do not know how I could add the class to the output for the search results.

What I would like to have happen I think is add the class "group1" to this: <li class="search-entry "> in the output below.

I've tried adding the class on the page, but that does nothing. I don't know the syntax or where I would need to add this type of thing to the code. Any suggestions or ideas for how I can get the search results on this page only to be randomly shown would be appreciated!!

My template page is using (% searchresults tags:member numWords:25 %)

And this is some of the output: http://sa-test.info/index.php?id=members

______________
<h1>Members</h1>
<div>
<h2 class="search-header">Search Results</h2>
<ul class="search-results ">
<li class="search-entry ">
<h3 class="search-entry-title">
<a href="http://sa-test.info/index.php?id=generations&amp;lang=en">
Generations, Inc. </a>
</h3>
Imsep pretu tempu revol bileg rokam revoc tephe rosve etepe tenov sindu turqu brevt elliu repar tiuve tamia queso utage udulc vires humus fallo 25deu <br /><br /> </li>
<li class="search-entry ">
<h3 class="search-entry-title">
<a href="http://sa-test.info/index.php?id=allen-investigations&amp;lang=en">
Allen Investigations </a>
</h3>
Imsep pretu tempu revol bileg rokam revoc tephe rosve etepe tenov sindu turqu brevt elliu repar tiuve tamia queso utage udulc vires humus fallo 25deu <br /><br /> </li>
</ul>
</div>
<script type="text/javascript">
//randomize order of contents with DIV class="group1"
randomizeContent("group1")
</script>

______
Reply
#2
sarnaiz Wrote:I found a random content script that uses a class="group1" to reorder content. I have already added it to the page and template for the page, but do not know how I could add the class to the output for the search results.

What I would like to have happen I think is add the class "group1" to this: <li class="search-entry "> in the output below.

I don't know this script, but probably you just have to call it with
Code:
randomizeContent("search-entry")
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
The script will randomize an element with the "group1" class so I need to get the search-entry class to have an additional class as that is the start of each group of data being displayed.

I don't know how I would use what you have written as I am not a programmer and don't know what else is required to make it work.

Also, I sent a PM to you to ask about what it would cost for you to add a random output to the search results for this and did not hear back. Did you get my PM?

Thanks!

EDIT: Should have said 'randomizes elements with the "group1" class.'

http://www.dynamicdrive.com/dynamicindex...torder.htm

<script type="text/javascript">

//randomize order of contents with DIV class="group1"
randomizeContent("group1")

</script>
Reply
#4
sarnaiz Wrote:The script will randomize an element with the "group1" class so I need to get the search-entry class to have an additional class as that is the start of each group of data being displayed.
...
http://www.dynamicdrive.com/dynamicindex...torder.htm
...

The description on above page states that the elements with the class name passed as parameter are randomized, thus the following - as already shown in the last post - should work:
Code:
<script type="text/javascript">
randomizeContent("search-entry")
</script>
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#5
Woohoo!!! Success on getting this to randomize. Needed a light bulb to go on apparently. I just swapped out the "group1" class and used "search-entry" in the code.

http://sa-test.info/index.php?id=members operational random search results on this page.

Thank you for you your help!!
Reply




Users browsing this thread: 1 Guest(s)