TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,234
  • Total Topics: 21,353
  • Online today: 639
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 262
  • Total: 263
  • @rjen

Random Post Block -- Advice Requested

Started by seelie, December 07, 2006, 02:55:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Thurnok

The original requestor placed JP Deni's code into the SSI.php file.  After doing that, you simply create a phpblock with the following:
ssi_randomquote();

However, you can put all of JP Deni's code into a phpblock itself without having to modify your SSI.php file.  The pros and cons in my opinion are:

  • SSI.php - good for reusable function if you plan to place the output in multiple locations on your site - not good for possible issues with updates to SMF / TP.
  • Block Code directly - good if you are going to only have it in this one location or possibly two.  Also does not affect upgrades to SMF/TP whatsoever (barring a change to global variable names in an SMF update which is not likely).  Bad if you want to use the functionality in numerous locations on your site or in a static file not under your forum.
Thurnok
The one, the only!

seelie

I am exceptionally pleased with how this turned out.  :up: :up:   And the site users rejoiced mightily ;)  If only to were so easy to make them happy with the Gallery ....  :o 

JPDeni

I'm so glad that it worked out for you. :) And users rejoicing is always good.

Gargoyle

I tried placing the code into a php block and I got errors...

Any idea what I am doing wrong ?

Thurnok

If you put in a TP Block, do not use the function around the code.  In otherwords:

function ssi_randomquote(){

// all the various code is here

}


Make it instead:


// all the various code here

Thurnok
The one, the only!

Gargoyle

Still getting parse code errors...

Does it need echo statements ?

Gargoyle

Found it... The code was missing a '; at the end.. ;D

Thanks!!!

deniz

i need random topic with first message and few words..
can you modifiy this code ??

JPDeni

Quoterandom topic with first message and few words..
How many is "few"? Can you be more explicit with what you want?

deniz


This website is proudly hosted on Crocweb Cloud Website Hosting.