TinyPortal

Development => Support => Topic started by: redone on June 04, 2005, 04:00:38 PM

Title: php block question
Post by: redone on June 04, 2005, 04:00:38 PM
i know pretty much nothing about php but could someone tell me how I would enter this in a php block for the portal?

<?php echo $_SERVER['HTTP_USER_AGENT']; ?>

Its very simple piece of code but whatever settings I have tried nothng works. I have searched and searched but still nothing!

Thanks.
Title: Re: php block question
Post by: IchBin on June 04, 2005, 05:42:44 PM
Only thing you don't need when entering php in a block is the php script tag. So it should look like this.

echo $_SERVER['HTTP_USER_AGENT'];
Title: Re: php block question
Post by: redone on June 04, 2005, 06:26:40 PM
Thanks a lot. I am just starting to experiment so your help is appreciated!

;)
Title: Re: php block question
Post by: IchBin on June 04, 2005, 08:47:22 PM
no prob
Title: Re: php block question
Post by: snowcrash on June 05, 2005, 10:56:55 AM
A related question when using the phpbox: how do you format a ssi_ call?

So for example, if you wanted to use ssi_topPoster();  - how would you specify the font style (type, size, etc) for the output?

thanks
Title: Re: php block question
Post by: burglar on June 05, 2005, 02:30:03 PM
in your style.css

put the following

.ssi_table

{
font-family: verdana;
font-size: 10px;
color: #000000;
background-color: #f0f0f0;
}


something simmilar
Title: Re: php block question
Post by: snowcrash on June 05, 2005, 04:10:39 PM
Thanks for the info burglar

I changed font size etc. & put this in the style.css of my default theme, which is the only one I use.

But had no effect of the text display of the phpbox - any ideas?

Bascially, I'm trying to format the text so it looks similar to the other default boxes available, such as recent topics.

regards
Title: Re: php block question
Post by: burglar on June 05, 2005, 06:11:17 PM
this works only with the ssi_functions

look at your forum/ssi_examples.php for some examples !!
Title: Re: php block question
Post by: snowcrash on June 05, 2005, 06:19:01 PM
Hi

I'm trying it with:
ssi_topPoster(); 
ssi_topTopicsViews();

Unless I'm missing something, these belong to the ssi_functions?

Also, in a newly created phpbox on the TP, I'm just putting in the function, eg.
ssi_topTopicsViews(5); 

straight into the box, and no other code - does something else have to be added

thanks
Title: Re: php block question
Post by: Bjørn on June 05, 2005, 11:37:51 PM
You should be fine with just typing it as it is.

As for adjusting its output, I suggest fetching it into an array , and doing things with that. For ssi_topPoster() that would mean:


      $my_top=ssi_topPoster(10, 'array');
      foreach($my_top as $my){
              echo '<b>'.$my['link'].'</b><br />';
       }
     


The same applies for ssi_topTopicsviews()

      $my_view=ssi_topTopicsViews(10, 'array');
      foreach($my_view as $my){
              echo '- '.$my['link'].' ( '.$my['num_views'].' )<br />';
       }
     


In the last you add the number of views like I did, even number of replies with this method.