Current location: Hot Scripts Forums » General Web Coding » CSS » PHP grief


PHP grief

Reply
  #1 (permalink)  
Old 11-02-08, 08:42 PM
Pr0digy Pr0digy is offline
Newbie Coder
 
Join Date: Aug 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
X_X PHP grief

Hello everybody,

For 2 days (no joke) i have been trying to get a very basic script to work.
The script works, but whatever gets echo'd is in a HUGE font size.
The rest of the page listens to my .css file except the echo.

I started experimenting with just 1 line of code, it works but again the font size is huge and i can not get it smaller.
PHP Code:

<?php 
    
echo "<font face=\"arial\"> <font size=-1>";
    echo;
        
// echo $model;
        
if ($model == YP4) echo "- BTO test";
    echo 
"</font>";
?>
This results in a huge "BTO test".

I need a line of code that forces the text to do what i say, i browsed hundreds of websites, tried pretty much anything i could find but no luck.

The only way i can get the text to size down is to adjust the table cell it's in, if i make the cell smaller... the text gets smaller. But that messes up the entire look of the page.

I have to add that i am making this page for my iPhone, everything behaves on the computer just not on the phone.

I'm pretty desperate here, hope anyone can help me.

Last edited by Nico; 11-03-08 at 03:20 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-02-08, 08:54 PM
Pr0digy Pr0digy is offline
Newbie Coder
 
Join Date: Aug 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
I played around with it some more, adding some pre-stuff i managed to get the size pretty much under control but now the Font isn't Arial anymore, looks like Courier.... sigh. Either way this seems like a whole lot of extra code just to change a font size so i'm fairly sure i'm going at it all wrong.
PHP Code:

<?php 
    
echo "<font face=\"arial\"> <font size=2>";
    echo 
"<pre class='news.css'>";
    echo;
        
// echo $model;
        // CPU Speed
        
if ($model == YP4) echo "- BTO test";
    echo 
"</pre>";
    echo 
"</font>";
?>

Last edited by Nico; 11-03-08 at 03:20 AM. Reason: Wrappers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-03-08, 03:27 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
I'm moving this to the CSS section since this isn't really a script request.

And try:
PHP Code:

<?php 

    
echo "<span style=\"font-family: arial; font-size: 11px;\">";
        
// echo $model;
        // CPU Speed
        
if ($model == YP4) echo "- BTO test";
    echo 
"</span>";
?>
... try to avoid <font> tags as they're deprecated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-03-08, 09:27 AM
Pr0digy Pr0digy is offline
Newbie Coder
 
Join Date: Aug 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
thank you!, will try and report back
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 11-03-08, 03:35 PM
Pr0digy Pr0digy is offline
Newbie Coder
 
Join Date: Aug 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
That worked great, thanks !!

There is just 1 problem... When i apply the same thing a few lines later... both don't listen to the font size i just set and do their own thing again. The code is identical just the cells the different codes are in differ in size.

Any thoughts ?

Here's the snippet:

PHP Code:

<pre style="white-space:pre;">
<table width="480" border="0" cellpadding="0" cellspacing="0" class="news">
  <tr>
    <td width="120"><strong>Processor Speed:</strong></td>
    <td width="360">
    <?php  
    
echo "<span style=\"font-family: arial; font-size: 12px;\">"
        
// echo $model;  
        
if ($model == YP4) echo "        - BTO test"
    echo 
"</span>"
    
?>
    </td>
  </tr>
</table>
</pre>

<pre style="white-space:pre;">
<table width="480" border="0" cellpadding="0" cellspacing="0" class="news">
  <tr>
    <td width="120"><strong>Processor Speed:</strong></td>
    <td width="360">
    <?php  
    
echo "<span style=\"font-family: arial; font-size: 12px;\">"
        
// echo $model; 
        
if ($model == YP4) echo "        - BTO test"
    echo 
"</span>"
    
?>
    </td>
  </tr>
</table>
</pre>
I also added the 'pre' thing to keep the tabs.

Last edited by Nico; 11-03-08 at 04:01 PM. Reason: [php] wrappers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 11-03-08, 04:11 PM
Pr0digy Pr0digy is offline
Newbie Coder
 
Join Date: Aug 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Ok, i figured out if i make everything font size 7 it looks great on the iPhone.
Down side it it looks super small on the computer.

I hope there is a way to adjust this script so that both devices display it correctly else i have to make a separate script for the iPhone (all 5400+ lines of it) and adding stuff will take twice as long as i have to add it to both files.

Does anyone have any experience with PHP development for an iPhone website ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 11-03-08, 09:33 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
I think there are some simple ways to detect if you've got a mobile user...once that's done your code can make whatever changes are appropriate. I haven't tested this code but you can give it a whirl:

PHP Code:

<?php

if ( strpos($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml')!==false ){

  
// It's a mobile device, do something appropriate

}else{

// do whatever you normally do for a regular browser

}

?>
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 11-04-08, 03:12 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 profitable script sites for sale cms-master.com General Advertisements 3 07-03-07 11:17 AM
help with error messages.. please APuppyDog PHP 2 10-06-06 12:09 AM
PHP Downside--Solutions? Amulet PHP 10 07-15-05 09:26 AM


All times are GMT -5. The time now is 06:14 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.