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

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
seb-nl
Posts: 17
Joined: Wed 8. Feb 2006, 14:50

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

Post 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
Last edited by seb-nl on Thu 22. Jun 2006, 14:04, edited 2 times in total.
erich_k4
Posts: 160
Joined: Thu 31. Mar 2005, 10:29
Location: Austria

Post 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
seb-nl
Posts: 17
Joined: Wed 8. Feb 2006, 14:50

Post by seb-nl »

thanx, I'm installing it right away to test it.

;-)
seb-nl
Posts: 17
Joined: Wed 8. Feb 2006, 14:50

Post 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
erich_k4
Posts: 160
Joined: Thu 31. Mar 2005, 10:29
Location: Austria

Post 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
seb-nl
Posts: 17
Joined: Wed 8. Feb 2006, 14:50

Post 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
seb-nl
Posts: 17
Joined: Wed 8. Feb 2006, 14:50

Post by seb-nl »

this is my structure, maybe its something there?
Last edited by seb-nl on Thu 27. Jul 2006, 09:43, edited 1 time in total.
erich_k4
Posts: 160
Joined: Thu 31. Mar 2005, 10:29
Location: Austria

Post 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
seb-nl
Posts: 17
Joined: Wed 8. Feb 2006, 14:50

Post 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
erich_k4
Posts: 160
Joined: Thu 31. Mar 2005, 10:29
Location: Austria

Post 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
seb-nl
Posts: 17
Joined: Wed 8. Feb 2006, 14:50

Post 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):
Last edited by seb-nl on Thu 27. Jul 2006, 09:43, edited 1 time in total.
seb-nl
Posts: 17
Joined: Wed 8. Feb 2006, 14:50

Post 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.."
Post Reply