Welcome to Geeklog Saturday, September 21 2019 @ 09:39 pm EDT

Geeklog Forums

Random tagline, how to do?


Status: offline

kreative

Forum User
Chatty
Registered: 15/08/04
Posts: 53
Location:Verona, Italy
Hi,
I would like to have a random tagline in my homepage (like www.airliners.net, check it, do a refresh and you will see a differenw window's title every time).
How can I do that?

Thanks a lot!!

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
You could overwrite $_CONF['site_slogan'] with in your lib-custom.php. Just put the code outside of any function and it will be executed for every page load.

bye, Dirk

Status: offline

kreative

Forum User
Chatty
Registered: 15/08/04
Posts: 53
Location:Verona, Italy
Great!!!
And........ how can I make a function to pick up the site slogan for, e.g., a txt file? I don't know php language...

Status: offline

LWC

Forum User
Full Member
Registered: 19/02/04
Posts: 818
Go to my site (click on my name) and download my PHP script "Random Text". It takes a random phrase (could be as short as a line in your case) from a quotes' file.

I've just updated it to be in the shape of a function. Now if you include it in system/lib-custom.php all you have to do is call it from config.php as Dirk said.

Since I've updated it just for you, please beta test the new version.

Status: offline

kreative

Forum User
Chatty
Registered: 15/08/04
Posts: 53
Location:Verona, Italy
I tried this solution (more simple):

- In config.php I added the following code:

$title[1] = "Title1";
$title[2] = "Title2";
$title[3] = "Title3";
$title[4] = "Title4";
$title[5] = "Title5";
$index = rand(1, count($title));


Then, I modified the following line:

$_CONF['site_slogan'] = $index[$title];

Is this a good tip?

Status: offline

LWC

Forum User
Full Member
Registered: 19/02/04
Posts: 818
I thought you wanted to use an external file that you can just fill up with quotes. If you want to write the quotes manually for your site then I guess your solution is good.

All times are EDT. The time is now 09:39 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content