Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Multiple titles in one page???


  • Please log in to reply
15 replies to this topic

#1 JacobHall

JacobHall

  • Members
  • 300 posts
  • OFFLINE
  •  
  • Local time:09:43 AM

Posted 10 April 2009 - 12:36 PM

Hi, I am developing a site for my online buisness and I wanted to have lots of page titles in one.

My son plays Habbo and he was on a site which looked pretty impressive!

The site is habborator.org and everytime you refresh it notice the The title at the top changes.

So for BC it is BleepingComputer.com all the time but with this HTML code or some sort of script you could make it different everytime it is opened.

EG

BleepingComputer
REFRESH
BC --> For all your computing needs
REFRESH
BC --> Most active computing forum on the net...

Thanks and anyone?????

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:03:43 AM

Posted 10 April 2009 - 01:02 PM

I don't see a title. I see a scrolling marquee. Is that what you are talking about?

#3 burn1337

burn1337

  • Banned
  • 311 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:43 AM

Posted 10 April 2009 - 07:08 PM

I see what you are talking about.... What you could do is either using php, or javascript... You can either set a numbered variable in a session, or a cookie... Or even have a random number generated each time the page is loaded, and then use a switch statement to switch between titles... For instance with php(this would have to be ran wile the script is still in the header before you open the body tags):
$TInt = rand(1, 8);
switch($Tint) {
case 1:
   echo "<title>Hello</title>";
   break;
....
default:
	echo "<title>Have a nice day</title>";
	break;
}

Now with javascript you can either set a random number, also if I remember correctly you do not need to set this one in the headers of the script, also seeing as Javascript is action script, you could also create a loop that waits for a certain amount of seconds changes the number and switches for the result (not sure what the function for that would be though)...
var TInt = rand(); //or any other method
switch(TInt) {
  case 1:
	document.title('Hello'); //It might be a different name for the document object to write to the title...
	 break; 
}

Edited by burn1337, 10 April 2009 - 07:09 PM.


#4 Romeo29

Romeo29

    Learning To Bleep


  • BC Advisor
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:04:43 AM

Posted 11 April 2009 - 01:11 AM

I would make a function to randomly select title of page and use SetInterval() to call it repeatedly.

//titles function chooses a random title
function titles(){
	var r = Math.floor(Math.random() * 3.0); //generates random number between 0 and 2
	var t = "";
	//select a title depending on random number	   
	switch(r){
		case 0 : t = "Welcome"; break;
		case 1 : t = "Goodbye"; break;
		case 2 : t = "Hello"; break;
		default: t = "Goodnight";
	}
	document.title = t; //set the title of current page
}
setInterval("titles()",1000); //calls the titles() function every 1000 milliseconds (1 second)

Edited by Romeo29, 11 April 2009 - 01:15 AM.


#5 burn1337

burn1337

  • Banned
  • 311 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:43 AM

Posted 11 April 2009 - 01:30 AM

Romeo - Thanks for correcting my Javascript, it has been awhile since I have actually done anything with it...

(btw people, my scripts where just sample/examples lol)

#6 Romeo29

Romeo29

    Learning To Bleep


  • BC Advisor
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:04:43 AM

Posted 11 April 2009 - 02:05 AM

Romeo - Thanks for correcting my Javascript, it has been awhile since I have actually done anything with it...

(btw people, my scripts where just sample/examples lol)


I know :thumbsup: Your code has a taste of PHP.

#7 burn1337

burn1337

  • Banned
  • 311 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:43 AM

Posted 11 April 2009 - 05:15 PM

Yea well, I have been doing everything in php lately... By the way I am almost done with the re-vision of my site... YAY lmao

#8 JacobHall

JacobHall
  • Topic Starter

  • Members
  • 300 posts
  • OFFLINE
  •  
  • Local time:09:43 AM

Posted 03 May 2009 - 10:06 AM

I would make a function to randomly select title of page and use SetInterval() to call it repeatedly.

//titles function chooses a random title
function titles(){
	var r = Math.floor(Math.random() * 3.0); //generates random number between 0 and 2
	var t = "";
	//select a title depending on random number	   
	switch(r){
		case 0 : t = "Welcome"; break;
		case 1 : t = "Goodbye"; break;
		case 2 : t = "Hello"; break;
		default: t = "Goodnight";
	}
	document.title = t; //set the title of current page
}
setInterval("titles()",1000); //calls the titles() function every 1000 milliseconds (1 second)


How do I go about installing that onot my server?

#9 Stofzuiger

Stofzuiger

  • Members
  • 332 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:The inside
  • Local time:10:43 AM

Posted 03 May 2009 - 10:33 AM

How do I go about installing that onot my server?


You implement in the code you want to =']

Every one goes fun fun fun


Who is this doin' this synthetic type of alpha beta psychedelic bleepin'? ~Chemical Brothers - Elektrobank


#10 JacobHall

JacobHall
  • Topic Starter

  • Members
  • 300 posts
  • OFFLINE
  •  
  • Local time:09:43 AM

Posted 03 May 2009 - 12:13 PM

How do I go about installing that onot my server?


You implement in the code you want to =']


yes... but where in my document :@

#11 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:03:43 AM

Posted 03 May 2009 - 04:55 PM

Where do you usually put your script?

#12 JacobHall

JacobHall
  • Topic Starter

  • Members
  • 300 posts
  • OFFLINE
  •  
  • Local time:09:43 AM

Posted 13 May 2009 - 05:38 AM

On my actual directory,

You see I want multiple titiles, but I wouldnt know howto make this script work, any help?

#13 TheStalker

TheStalker

  • Members
  • 58 posts
  • OFFLINE
  •  
  • Local time:05:43 AM

Posted 13 May 2009 - 10:19 AM

not really tested but off the top of my head prob just some thing like this

$title1 = "Page title 1";
$title2 = "Page title 2";
$title3 = "Page title 3";
$title4 = "Page title 4";
$title5 = "Page title 5";

$random = rand(0,4);
if($random ==0)
{
	$title = $title1;
}
else if ($random == 1)
{
	$title = $title2;
}
else if ($random == 2)
{
	$title = $title3;
}
else if ($random == 3)
{
	$title = $title4;
}
else if ($random == 4)
{
	$title = $title5;
}


?>
<html>
<head>
<title> <?php echo $title;?> </title>

</head>
</html>

Edited by TheStalker, 13 May 2009 - 10:21 AM.


#14 JacobHall

JacobHall
  • Topic Starter

  • Members
  • 300 posts
  • OFFLINE
  •  
  • Local time:09:43 AM

Posted 14 May 2009 - 05:00 PM

Yes, but how do I make it work on my website?

Its alright having the code but I dont know where it should go... Head? footer , body!

Thanks
Jake

#15 JacobHall

JacobHall
  • Topic Starter

  • Members
  • 300 posts
  • OFFLINE
  •  
  • Local time:09:43 AM

Posted 14 May 2009 - 05:07 PM

Because, I am not good with website coding whatsoever, I just get by




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users