Dynamic forum Signature displaying most recent forum topics

Started by ferrazf, February 08, 2007, 03:44:52 PM

Previous topic - Next topic

ferrazf

Hi,

Alright, some of you may have heard of dynamic images used in forum signatures. Pretty much it is a PHP script that you input as your forum signature, which links to a random image. There is also a way for this image to have changing text, as described here

What I wanted to do was extend this idea further, and instead of using a static TXT file for the text in the image, as the link above suggests, perhaps I could use a dynamic txt as well. For this, it would probably be necessary to have a sort of "exporter" which would save in this TXT file the titles for the most recent topics in the user's SMF forums. That way you would have a sig that randomly displays the titles for your most recent forum topics. I have no idea how feasible this is, perhaps  someone could enlighten me a bit.


Thanks!

rotterweil

I created a thingy that randomly changes the administrator's signature everytime when viewed. This is not a picture, but plain text.

If you are interested, I can show you what I did.
Life is either a great adventure or nothing.
- Helen Keller

Cypher7

Quote from: rotterweil on April 28, 2007, 01:38:11 PM
I created a thingy that randomly changes the administrator's signature everytime when viewed. This is not a picture, but plain text.

If you are interested, I can show you what I did.

I'd be interested, but would also like to be able to reslove the issue, where dynamic image signatures appear correctly...

rotterweil

I am pretty new to SMF, and have never worked with dynamic images before. But I'm sure the principle should be the same.

I also "think" that custom changes to your files should be implemented via a mod, otherwise all will be lost once you upgrade? Am I right here? Anyway, I am playing around, so I didn't.

This is what I did:

In my template, Display.template.php

Find this line:

Quote// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']))
   echo '
      <hr width="100%" size="1" class="hrcolor" />
      <div class="signature">', $message['member']['signature'], '</div>';

And I changed it to look like this:

Quoteif (!empty($message['member']['signature']) && empty($options['show_no_signatures']))
{
     if($message['member']['id']==1)     //this is admin ID, can also use ['is_admin']
     {
       require_once("../db/func_drusba.php");    //this is my own php scriptfile
       //DrusbaSignature is just a normal php scripts that reads random lines out of the
           // datebase
            echo '
            <hr width="100%" size="1" class="hrcolor" />
            <div class="signature">', DrusbaSignature(), '</div>';
   }   
   else
      echo '
         <hr width="100%" size="1" class="hrcolor" />
         <div class="signature">', $message['member']['signature'], '</div>';
}


What's your thoughts?  This is hardcoded for one single user, but I'm sure if one played around, you could assign this to a user group instead of admin. Or maybe add your own code like [dbfunction]......[/dbfunction] or something like that.

Is this usable?
Life is either a great adventure or nothing.
- Helen Keller

Advertisement: