Page 1 of 1

[solved] random content out of a category, help needed

Posted: Tue 7. Mar 2006, 10:44
by seb-nl
Hi Guys,

I've been searching through the forum for days. I have found hacks that come close, but i think none actually fits.

The idea is a random testimonial, it shows the summary and (sub)title of a random article in a category named "testimonials". In a second template, it shows random out of category "testimonials NL".

Is there anyone that can adapt an existing RT hack, or create a new one to work like this?

Below a screenshot of how it should work.

Looking forward to an idea, since i really have no clue how to solve this without having to tell my client that he cant manage the testimonials since its an external script displaying them.

Thanx in advance!
Seb

Posted: Tue 7. Mar 2006, 10:55
by erich_k4
I think teaser_ex can handle this....


The tag may look like this:

{TEASER_EX:testimonials|1:1:rand():0::1:13:mytemplate.tmpl:-1:}

More info at:
http://www.phpwcms.de/forum/viewtopic.php?t=7503

Let me know if you need further assistance...

Erich

Posted: Tue 7. Mar 2006, 10:58
by seb-nl
thanx, I'm installing it right away to test it.

;-)

Posted: Tue 7. Mar 2006, 12:02
by seb-nl
Hi Erich,

It doesn't work.

This is the exact rt i used:

{TEASER_EX:testimonials|1:1:rand():0:1:13:mytemplate.tmpl:-1:}

+front end init is on since i use dhtmldropdown.php which is working fine.
+the cat. exists en has 3 articles in it

Any ideas?

Thanx
/seb

Posted: Tue 7. Mar 2006, 13:35
by erich_k4
seb-nl wrote:Hi Erich,

It doesn't work.

This is the exact rt i used:

{TEASER_EX:testimonials|1:1:rand():0:1:13:mytemplate.tmpl:-1:}

+front end init is on since i use dhtmldropdown.php which is working fine.
+the cat. exists en has 3 articles in it

Any ideas?

Thanx
/seb
The above RT is a sample only... :D


Try this one:

{TEASER_EX:testimonials|1:1:rand():0:1::sample.tmpl:-1:}

(if there is no template named "mytemplate.tmpl" in "phpwcms_template\inc_cntpart\articlesummary\list" it will not work..., so try sample.tmpl)



Erich

Posted: Tue 7. Mar 2006, 13:47
by seb-nl
Hi Erich,

I've tried. Still doesnt work. :-(

I created the mytemplate.tmpl, tested it with both sample.tmpl and mytemplate.tmpl. No effect.

>> It shows the tag instead of any content, so there must be a small mistake in it.

is the problem the rand() part?

thanx in advance for your help
/seb

Posted: Tue 7. Mar 2006, 13:51
by seb-nl
this is my structure, maybe its something there?

Posted: Tue 7. Mar 2006, 14:18
by erich_k4
My mistake!

The version on my website is the new 1.6 instead of 1.52, i uploaded the wrong version..... :roll:

So it cant work, because there are 3 arguments missing!

Please look at the source-code!

Another try:

{TEASER_EX:testimonials|1:1:rand():1::1::sample.tmpl:-1::0:2:70}

Erich

Posted: Tue 7. Mar 2006, 14:36
by seb-nl
Great!

It works!!

Thank you so much!

There's only one thing. Even though I've setup mytemplate.tmpl, like so:

<p class="rtestcomma">{SUMMARY}</p>
<ul>
<li class="rtestref">{SUB}</li>
<li class="rnewslinksli"><a href="index.php?testimonials" class="rnewslinks">more testimonials</a></li>
</ul>

It keeps wrapping your 'template' around it:


<!-- START NEWS TABLE -->
<table id="teaserTable"><tr><td id="teaserTableLeftCell" valign="top" width="100%"><p class="rtestcomma"><p><font color="#000000">Managing phone costs of our forresters is as easy as&nbsp;tearing an fifteenyears old oak down.</font></p></p>
<ul>
<li class="rtestref">Boris Eikelhoofd, CEO WestBosbeheer</li>
<li class="rnewslinksli"><a href="index.php?testimonials" class="rnewslinks">more testimonials</a></li>
</ul></td></tr></table>
<!-- END NEWS TABLE -->

How do i prevent this from happening? search it up in the .php or give some sort of parameter?

I used this RT: {TEASER_EX:testimonials|1:1:rand():1::1::mytemplate.tmpl:-1::0:2:70}

/seb

Posted: Tue 7. Mar 2006, 14:46
by erich_k4
seb-nl wrote:Great!

It works!!

Thank you so much!

There's only one thing. Even though I've setup mytemplate.tmpl, like so:

<p class="rtestcomma">{SUMMARY}</p>
<ul>
<li class="rtestref">{SUB}</li>
<li class="rnewslinksli"><a href="index.php?testimonials" class="rnewslinks">more testimonials</a></li>
</ul>

It keeps wrapping your 'template' around it:


<!-- START NEWS TABLE -->
<table id="teaserTable"><tr><td id="teaserTableLeftCell" valign="top" width="100%"><p class="rtestcomma"><p><font color="#000000">Managing phone costs of our forresters is as easy as&nbsp;tearing an fifteenyears old oak down.</font></p></p>
<ul>
<li class="rtestref">Boris Eikelhoofd, CEO WestBosbeheer</li>
<li class="rnewslinksli"><a href="index.php?testimonials" class="rnewslinks">more testimonials</a></li>
</ul></td></tr></table>
<!-- END NEWS TABLE -->

How do i prevent this from happening? search it up in the .php or give some sort of parameter?

I used this RT: {TEASER_EX:testimonials|1:1:rand():1::1::mytemplate.tmpl:-1::0:2:70}

/seb

Comment out

line 432, 439-443, 617

Posted: Tue 7. Mar 2006, 14:56
by seb-nl
Parse error: syntax error, unexpected '}' in D:\xampplite\htdocs\phpwcms_template\inc_script\frontend_render\reptag_teaser_ex.php on line 630

Errrr.... Commented out as you said but now this happens.

Here's the file (lines 432-end):

Posted: Wed 8. Mar 2006, 15:04
by seb-nl
solved...

I've replaced the values in the corresponding lines with \n.

works perfect, it only wraps my own mytemplate.tmpl now.

a HUGE thanx to you Erich

a famous quote is at its place here:

"I just love it when a plans come together.."