Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> A Monthly Web Title Script
Blessed
post Apr 20 2007, 06:06 AM
Post #1


Advanced Member
*******

Group: Members
Posts: 144
Joined: 22-March 07
Member No.: 40,472



Greetings

This tutorial explains how to change the web title mountle.
we are going to use the rand and the switch function.

//
// Mode setting: 0 = just random, 1 = random but based on date
//

start making you page.
at the top of the page add.
CODE
<?php
$titles_array = array(  
   'Title 0',  
   'Title 1',  
   'Title 2',  
   'Title 3',  
   'Title 4'  
   );


define the titles..

After add.

CODE
$mode = 1;  
switch( $mode )  
{  
   case 0:  
       // Just get a random title  
       $page_title = $titles_array[mt_rand(0,count($titles_array)-1)];  
       break;

you can change mode to 0 to use this methode.
now we get a title by using the rand function.

after add..

CODE
case 1:  
       // Grab a title based on month  
       $month = date('n');  
       $array_max = count($titles_array);  
        
       $page_title = $titles_array[$month % $array_max];  
       break;  
}  
        
?>

now we grab a title base on the month
we get the current month by using the date('n') function.
then we count the titles.

After add.
CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">    
<html xmlns="http://www.w3.org/1999/xhtml">    
<head>    
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />    
<title><?php echo $page_title; ?></title>    
</head>    

<body>    
Just a simple PHP tut    
</body>    
</html>



FINALY WE DONE

have fun whit it laugh.gif
Go to the top of the page
 
+Quote Post
matak
post Apr 20 2007, 11:08 AM
Post #2


Super Member
*********

Group: Members
Posts: 413
Joined: 4-October 06
From: Psychedelic Realms
Member No.: 31,079



I see you are having fun with php these days. Nice work. Thanks for introducing few cool functions.

A small tweak to your script. Maybe you want random images. Just a simple html output like this..

CODE
<?php echo '<img src="images/random_image_'.$page_title.'.gif" alt="No image">'; ?>


Should use your numbers to walk through random images in images folder (random_image_0.gif, random_image_1.gif, ...etc till 4.

Maybe you can improve this script to work in total, i think that few tweaks have to be done.. Maybe later biggrin.gif
Go to the top of the page
 
+Quote Post
Blessed
post Apr 20 2007, 02:06 PM
Post #3


Advanced Member
*******

Group: Members
Posts: 144
Joined: 22-March 07
Member No.: 40,472



QUOTE(matak @ Apr 20 2007, 11:08 AM) *
I see you are having fun with php these days. Nice work. Thanks for introducing few cool functions.

A small tweak to your script. Maybe you want random images. Just a simple html output like this..

CODE
<?php echo '<img src="images/random_image_'.$page_title.'.gif" alt="No image">'; ?>


Should use your numbers to walk through random images in images folder (random_image_0.gif, random_image_1.gif, ...etc till 4.

Maybe you can improve this script to work in total, i think that few tweaks have to be done.. Maybe later biggrin.gif



yes it add some more things to it later

thanx for the reply
Go to the top of the page
 
+Quote Post
Saint_Michael
post Apr 20 2007, 10:28 PM
Post #4


$p4m 0n j00 $h4m3 m3 0nc3 $p4m 0n m3 $h4m3 m3 7\/\/1c3
*********************

Group: [HOSTED]
Posts: 6,798
Joined: 21-September 04
From: 9r33|\| 399$ 4|\|D 5P4/\/\
Member No.: 1,218
T17 GFX Crew
myCENT:READY[102.80]



Just a small warning about using this script, in which I gave a similar post before about something similar to use. If you want your website to be index properly in search engines like google do not use it, because if you constantly change your website title then your site will not get index properly and you could also get denied for search engine cheating in someway. But if you don't care about that and just making a personal site then go right ahead and use it to your hearts content.
Go to the top of the page
 
+Quote Post
Blessed
post Apr 23 2007, 11:13 AM
Post #5


Advanced Member
*******

Group: Members
Posts: 144
Joined: 22-March 07
Member No.: 40,472



QUOTE(Saint_Michael @ Apr 20 2007, 10:28 PM) *
Just a small warning about using this script, in which I gave a similar post before about something similar to use. If you want your website to be index properly in search engines like google do not use it, because if you constantly change your website title then your site will not get index properly and you could also get denied for search engine cheating in someway. But if you don't care about that and just making a personal site then go right ahead and use it to your hearts content.



i agree whit you m8

but can you use the google adds whit this script
Go to the top of the page
 
+Quote Post
Saint_Michael
post Apr 23 2007, 06:00 PM
Post #6


$p4m 0n j00 $h4m3 m3 0nc3 $p4m 0n m3 $h4m3 m3 7\/\/1c3
*********************

Group: [HOSTED]
Posts: 6,798
Joined: 21-September 04
From: 9r33|\| 399$ 4|\|D 5P4/\/\
Member No.: 1,218
T17 GFX Crew
myCENT:READY[102.80]



hmm... With the google ad's I would say it could be logical that you could get denied, but I don't know the innre workings for adsense so person who does use adsense would have a better answer for you.
Go to the top of the page
 
+Quote Post
Blessed
post Apr 24 2007, 04:52 PM
Post #7


Advanced Member
*******

Group: Members
Posts: 144
Joined: 22-March 07
Member No.: 40,472



Gretings

thanx for your answer m8
i will look arround on the net to find my answer for the question.
Go to the top of the page
 
+Quote Post
srujanlive
post Apr 24 2007, 06:55 PM
Post #8


Super Member
*********

Group: Members
Posts: 222
Joined: 15-April 07
Member No.: 41,662



That is a quite cool trick. Thanks very much man. Continue providing more such tricks
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Many Php Script Sites(16)
  2. Script: Php Jukebox(6)
  3. Parse: Error Unexpected T_lnumber(4)
  4. Transfer Variables To Another Php Script(9)
  5. Watermark Your Image With Simple Php Script(35)