Bungie.net Community
This topic has moved here: Subject: Title generator
  • Subject: Title generator

Only Becausae I'm Awesome

Forum Tutorials --- WATCH THEM AND LEARN

Posted by: Echo Ranger 449
You know the phrase that's listed at the top of the main page? Known to web designers as the "title", every time you load that page, you'll usually get a different one. I like that idea and I was wondering where I could get that title generator, assuming that it's free or available somewhere else for free. Thanks!


<?
$title_array = array('test','test2','test3');
$tmpran = rand(0, count($title_array)-1);
print "<title>".$title_array[$tmpran]."</ti tle>";
?>


Change the values in the array() to anything you want. You can have as many as you want. Just make sure each one is in their own quotes and seperated by commas.

  • 04.14.2007 7:30 PM PDT
Subject: Title generator
  • gamertag:
  • user homepage:
  • last post: 01.01.0001 12:00 AM PDT

You know the phrase that's listed at the top of the main page? Known to web designers as the "title", every time you load that page, you'll usually get a different one. I like that idea and I was wondering where I could get that title generator, assuming that it's free or available somewhere else for free. Thanks!

  • 04.14.2007 6:55 PM PDT
  • gamertag:
  • user homepage:
  • last post: 01.01.0001 12:00 AM PDT

did this get moved or something?

never mind. wait, wtf?!!! whenever i hit 'reply', the forum name banner says 'Underground'. but before and after i submit it, it goes back to normal!

anyway, on-topic now, you should find the thread with the list of all the titles.

[Edited on 04.14.2007 9:09 PM PDT]

  • 04.14.2007 9:07 PM PDT
  • gamertag:
  • user homepage:
  • last post: 01.01.0001 12:00 AM PDT

Thanks littlerat!

Oh, here is another version I found:


<script type="text/javascript">

// Setup an array of titles.
var titles = new Array(5);
titles[0] = "test1";
titles[1] = "test2";
titles[2] = "test3";
titles[3] = "test4";
titles[4] = "test5";

// Set the title to a random member of our array.
document.title = titles[Math.round(4 * Math.random())];

</script>


[Edited on 04.15.2007 11:17 AM PDT]

  • 04.15.2007 10:46 AM PDT

Yeah, Echo. Your script is Javascript; his is PHP. If your host supports PHP, his way is better, but if not, you can use that one.

PHP:
<?PHP
$title_array = array('test', 'test2', 'test3');
$tmpran = rand(0, count($title_array)-1);
print "<title>".$title_array[$tmpran]."</ti tle>";
?>

(Make sure you take that space out of the </title>. I can't take it out for some reason.)
Javascript:
<SCRIPT TYPE="TEXT/JAVASCRIPT">

// Setup an array of titles.
var titles = new Array(5);
titles[0] = "test1";
titles[1] = "test2";
titles[2] = "test3";
titles[3] = "test4";
titles[4] = "test5";

// Set the title to a random member of our array.
document.title = titles[Math.round(4 * Math.random())];

</SCRIPT>



[Edited on 04.15.2007 12:16 PM PDT]

  • 04.15.2007 12:01 PM PDT

I work here: Sound Devices, LLC. We make bad-ass field audio gear, and you think that's awesome. My messy desk (With work-related items on the computer screen).

One does not simply grenade jump into Mordor...

Posted by: Echo Ranger 449
You know the phrase that's listed at the top of the main page? Known to web designers as the "title", every time you load that page, you'll usually get a different one. I like that idea and I was wondering where I could get that title generator, assuming that it's free or available somewhere else for free. Thanks!

There's about a million different ways to do it. Just go read a tutorial about javascript, php, VB/C# (ASP.net), perl, or whatever else your web host supports and you feel like learning.

  • 04.15.2007 10:50 PM PDT
  •  | 
  • Exalted Mythic Member
  • gamertag: [none]
  • user homepage:

The End

‘The conscious is cancerous if allowed to linger’

"Even if you're on the right track, you'll get run over if you just sit there."

Posted by: Echo Ranger 449
Thanks littlerat!

Oh, here is another version I found:


<script type="text/javascript">

// Setup an array of titles.
var titles = new Array(5);
titles[0] = "test1";
titles[1] = "test2";
titles[2] = "test3";
titles[3] = "test4";
titles[4] = "test5";

// Set the title to a random member of our array.
document.title = titles[Math.round(4 * Math.random())];

</script>


Is there a way of making images change instead?

  • 04.15.2007 11:02 PM PDT
  •  | 
  • Exalted Mythic Member
  • gamertag: [none]
  • user homepage:

The End

‘The conscious is cancerous if allowed to linger’

"Even if you're on the right track, you'll get run over if you just sit there."

I managed to get it to work on my site, linkage- http://www.activeboard.com/forum.spark?forumID=108513&p=1 , check it out, it is awesome!

  • 04.16.2007 12:13 AM PDT

Only Becausae I'm Awesome

Forum Tutorials --- WATCH THEM AND LEARN

Posted by: TOM T 117
Is there a way of making images change instead?

Essentially the same code.

<?PHP
$image_url_array = array('http://image1url.jpg', 'folder/image2.gif', 'image3.jpg');
$tmpran = rand(0, count($image_url_array)-1);
$image = $image_url_array[$tmpran];
print "<img src='$image'>";
?>

Wherever you want your image to go. I made $image a seperate line cause it broke bungie.net.

I'm sure their might be an easier way to do that though.

[Edited on 04.16.2007 1:42 AM PDT]

  • 04.16.2007 1:40 AM PDT
  • gamertag:
  • user homepage:
  • last post: 01.01.0001 12:00 AM PDT

*sigh*
I tried using the PHP code, and it didn't work: invisionfree isn't that tolerant, but hey, it's a pretty fun piece of software and it has a good network of servers ;)

  • 04.16.2007 7:15 PM PDT