Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 04-25-2009, 05:38 AM   PM User | #16
Len Whistler
Regular Coder

 
Len Whistler's Avatar
 
Join Date: Jul 2002
Location: Vancouver, BC Canada
Posts: 949
Thanks: 22
Thanked 39 Times in 39 Posts
Len Whistler is on a distinguished road
Quote:
Originally Posted by Mark P View Post

CMS adds a whole new dimension to what basically is a very simple script that uses either a TXT file or XML file. The end user doesn't have to learn much to edit any of the examples above. Now you can go the CMS route but it will add a lot of extra coding and you must make it as "idiot" proof as you can.

I would maybe work on the CMS as your next project after this one.

--
__________________
Leonard Whistler
Len Whistler is offline   Reply With Quote
Old 05-06-2009, 03:32 PM   PM User | #17
Mark P
New Coder

 
Join Date: Apr 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Mark P is an unknown quantity at this point
Quote:
Originally Posted by Len Whistler View Post
I have updated my code from post 4 with an added feature, adding a headline for each show. It also outputs the day of the week. Instead of an external file you could also just add the content to the switch statement.


PHP Code:
<?php

  $day_of_the_week 
date('N'); // 1 (for Monday) through 7 (for Sunday)
  
$hour date('H'); // 24 hour format as 2 digits. 01 - 24

  
$hourly_show $day_of_the_week '_' $hour// example 1_09 (Monday 9am)

  
switch ($hourly_show) {
  case 
'1_16'//day hour
  
$current_show "1_1600_danny_james.txt";
  
$show_presenter =  "Danny James - Drive Time Show";
  break;

  case 
'3_17':
  
$current_show "3_1700_mr_valley.txt";
  
$show_presenter =  "B-Rock Sessions With Mr Valley";
  break;

  default:
  
$current_show "1_0100_rock_roll.txt";
  
$show_presenter =  "Hill Billy Rock";
  break;
  }

  
$current_show file_get_contents("$current_show");

  echo 
"<h1>$show_presenter</h1>";
  echo 
"<p>$current_show</p>";

?>
Advantage: TXT files have easy to read names and when viewing in the folder will list in playing order. Coding easy to follow once coded.
Disadvantage: Lots of coding. 168 TXT files might be cumbersome to handle. XML might be the better in this situation, or add the TXT file content to the switch statement.


----------


------------------

This code is working great To avoid all the text files I put the show description in the php file here
PHP Code:
$show_presenter =  "Danny James - Drive Time Show"
I would like to do a couple of things to make it fit the site better with regards to appearance. How would I change the font size/type that is displayed? I tried adding this code to the file but it didnt work
PHP Code:
$text_colour "0,0,0";
  
$text_size "3"$font "verdana"
Also where is the php file following time from? Is it based on server time? As my server is located 1 hour ahead of my timezone but the show title is still displaying correctly for that hour. Or is it based on browsers local time?

Any information greatly appreciated. Thanks
Mark P is offline   Reply With Quote
Old 05-06-2009, 09:40 PM   PM User | #18
Len Whistler
Regular Coder

 
Len Whistler's Avatar
 
Join Date: Jul 2002
Location: Vancouver, BC Canada
Posts: 949
Thanks: 22
Thanked 39 Times in 39 Posts
Len Whistler is on a distinguished road
Quote:
Originally Posted by Mark P View Post
How would I change the font size/type that is displayed?
I would use CSS and apply it to headlines, paragraphs, spans of text.


Quote:
Originally Posted by Mark P View Post
Also where is the php file following time from? Is it based on server time? As my server is located 1 hour ahead of my timezone but the show title is still displaying correctly for that hour. Or is it based on browsers local time?
Yes ...it's server time. PHP has some timezone functions you can use to change the output to another timezone. http://ca3.php.net/datetime


-------------
__________________
Leonard Whistler
Len Whistler is offline   Reply With Quote
Old 05-07-2009, 01:27 PM   PM User | #19
Mark P
New Coder

 
Join Date: Apr 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Mark P is an unknown quantity at this point
Hello, thanks for the reply. That is working great thanks
One last tiny part that I need to sort out, I changed the font size/type in css, it displays perfect in Firefox, but IE is displaying it outsized, far too big. Ive searched the net for some information as to why IE wouldnt display the size correctly but havent been able to find anything.
Can anyone think of a reason why IE would not be showing the text in the font/size I specified in css?
Thanks
Mark P is offline   Reply With Quote
Old 05-07-2009, 07:05 PM   PM User | #20
Mark P
New Coder

 
Join Date: Apr 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Mark P is an unknown quantity at this point
Hello again, on closer inspection it would appear IE is showing the correct colour & font but comepletely ignoring the size.
Im aware that Firefox & Chrome skip errors in code, unlike IE which reverts to a default if an error is present,

<style type="text/css">

body,td,th {
font-family: Verdana;
font-size: 5px;
color: #666666;
font-weight: bold;
}

</style>

This is the code Im using, I'll be blowed if I can see an error in it though Im assuming this is a css issue.
Any help greatly appreciated.
Thanks
Mark P is offline   Reply With Quote
Old 11-07-2009, 02:54 PM   PM User | #21
Mark P
New Coder

 
Join Date: Apr 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Mark P is an unknown quantity at this point
Hello, I still have this problem & would love to resolve it after all these months. The text is not displaying corectly in any browser, my css is being ignored.
This is the header of my php page

<!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="refresh" content="180">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Now Playing</title>
<style type="text/css">
body,h1 {
body{background-color: transparent;
font-family: Verdana;
font-size: 10px;
color: #FFFFFF;
font-weight: bold;
}
</style>
</head>
<body>

Any help would be great. Thanks
Mark P is offline   Reply With Quote
Old 11-07-2009, 03:07 PM   PM User | #22
met
Regular Coder

 
Join Date: Oct 2009
Location: United Kingdom
Posts: 236
Thanks: 2
Thanked 33 Times in 33 Posts
met is an unknown quantity at this point
your css is wrong..

PHP 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="refresh" content="180">
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
title>Now Playing</title>
<
style type="text/css">
body,h1 {
body{background-colortransparent/* this */
font-familyVerdana;
font-size10px;
color#FFFFFF;
font-weightbold;
}
</
style>
</
head>
<
body
it should be

PHP 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="refresh" content="180">
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
title>Now Playing</title>
<
style type="text/css">
bodyh1 {
background-colortransparent;
font-familyVerdana;
font-size10px;
color#FFFFFF;
font-weightbold;
}
</
style>
</
head>
<
body>
<
h1>Header</h1>
<
p>Content</p>
</
body>
</
html
also note you are setting the font colour to be white, and not specifying a background, which is white by default..so you won't really see anything anyway.
met is offline   Reply With Quote
Old 11-08-2009, 03:04 PM   PM User | #23
Mark P
New Coder

 
Join Date: Apr 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Mark P is an unknown quantity at this point
Hello, thankyou for the reply. I managed to sort the problem out. Do you know where I would put the <marque> tag in this code to get the current show text to scroll?

PHP Code:
<?php

  $day_of_the_week 
date('N'); // 1 (for Monday) through 7 (for Sunday)
  
$hour date('H'); // 24 hour format as 2 digits. 01 - 24

  
$hourly_show $day_of_the_week '_' $hour// example 1_09 (Monday 9am)

  
switch ($hourly_show) {
  case 
'1_16'//day hour
  
$current_show "1_1600_danny_james.txt";
  
$show_presenter =  "Danny James - Drive Time Show";
  break;

  case 
'3_17':
  
$current_show "3_1700_mr_valley.txt";
  
$show_presenter =  "B-Rock Sessions With Mr Valley";
  break;

  default:
  
$current_show "1_0100_rock_roll.txt";
  
$show_presenter =  "Hill Billy Rock";
  break;
  }

  
$current_show file_get_contents("$current_show");

  echo 
"<h1>$show_presenter</h1>";
  echo 
"<p>$current_show</p>";

?>
Thanks
Mark P is offline   Reply With Quote
Old 11-08-2009, 04:10 PM   PM User | #24
met
Regular Coder

 
Join Date: Oct 2009
Location: United Kingdom
Posts: 236
Thanks: 2
Thanked 33 Times in 33 Posts
met is an unknown quantity at this point
PHP Code:
  }

  
$current_show file_get_contents("$current_show");

  echo 
"<h1>$show_presenter</h1>";
  echo 
"<marquee>$current_show</marquee>";

?> 
altho imo i must say marquee's are truly a horrible way of displaying content
met is offline   Reply With Quote
Old 11-13-2009, 04:28 PM   PM User | #25
Mark P
New Coder

 
Join Date: Apr 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Mark P is an unknown quantity at this point
Thankyou, I will try that code
Mark P is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:34 AM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.