Help Creating A 'Box' like interface.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
iSDK
Forum Newbie
Posts: 2
Joined: Sat Jan 01, 2011 8:08 pm

Help Creating A 'Box' like interface.

Post by iSDK »

Hi This is my first post! I only have knowledge of objective-c, and I really need some help with this php for an iPhone Application I am making. Any code is really useful!! I am trying to create an interface with one skyscraper advert on the left, one on the right, and a leaderboard advert at the top, and a leaderboard advert at the bottom. However this is not working for some reason, and this is what it is turning out to look like: http://nucleusiphone.com/adverts/index. ... D368016758.

If you could help me fix this up to look like a box i.e a skyscraper advert on both the left and right, and a leaderboard banner on both the top and bottom of the page that would be great.

Thanks in advanced

Here is my code:

Code: Select all

<?php 
$url = $_GET['url'];
header("refresh:5;url=$url"); 
//echo $url;
?>
<p align=left>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3255541264170057";
/* sky */
google_ad_slot = "5476903356";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</p>
<html>
<head>
<title>Redirecting to <? echo $url?></title>
</head>
<body>

<script language="javascript">

var time_left = 5;
var cinterval;

function time_dec(){
  time_left--;
  document.getElementById('countdown').innerHTML = time_left;
  if(time_left == 0){
    clearInterval(cinterval);
  }
}

cinterval = setInterval('time_dec()', 1000);

</script>
<center><script type="text/javascript"><!--
google_ad_client = "ca-pub-3255541264170057";
/* Shortener Ads */
google_ad_slot = "2410296885";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center>
<center>
You will be redirected in <span id="countdown">5</span>.</center><br>
<center><br>Click <? echo "<a href=" . $url . "> here </a>to go now." ?></center><br>

<center><script type="text/javascript"><!--
google_ad_client = "ca-pub-3255541264170057";
/* Shortener Ads */
google_ad_slot = "2410296885";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center>
<p align=right>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3255541264170057";
/* sky */
google_ad_slot = "5476903356";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
</body>
Neilos
Forum Contributor
Posts: 179
Joined: Fri Nov 19, 2010 2:07 am

Re: Help Creating A 'Box' like interface.

Post by Neilos »

It is not php that you have the problem with if all you need is positioning help. You can accomplish that using a cascading style sheet. Give the tags an id and then you can use css to define the size and position.

All of this;
[syntax]
<p align=left>
<p align=right>
[/syntax]
is bad practice nowadays, try to get out of the habit of styling inline with your code.

The;
[syntax]
<center>
[/syntax]
tag is depreciated and should be avoided. Again you can accomplish all this with css.

Also you have a <p> tag above the <html> which is again bad practice.

Using css you should use something that looks like;
[syntax]
p#left_bar {

width: 50px;
height: 300px;
position: absolute:
top: 100px;
left: 0px;

}
[/syntax]
I hope this helps. (The iphone is compatible with css)
iSDK
Forum Newbie
Posts: 2
Joined: Sat Jan 01, 2011 8:08 pm

Re: Help Creating A 'Box' like interface.

Post by iSDK »

thanks, would you mind telling me how to implement the css code, and how to call the css code in the code I provided? Maybe you could also provide an example if you dont mind! Sorry, I am a complete noob at php.
Neilos
Forum Contributor
Posts: 179
Joined: Fri Nov 19, 2010 2:07 am

Re: Help Creating A 'Box' like interface.

Post by Neilos »

Lol, again this is not a php issue.

If you would like to learn about css then I suggest that you read http://www.w3schools.com/css/css_intro.asp.

css is easy. Your HTML elements in css are either referenced by their type, an id you give them or a class you give them.

This is a php forum though, but I'll give you a quick example but then I suggest that you read the tutorials at the link I gave you.

HTML code
[syntax]
<html>

<head>
<title>Hello</title>
</head>

<body>

<h1>This is a title, and it is blue!</h1>

<div class="red_text">This text is red.</div>

<div class="red_text">This text is also red.</div>

<div id="positioned">This div has been positioned</div>

</body>

</html>
[/syntax]

CSS code
[syntax]
h1 {
color: #00ff00;
}

div .red_text {
color: #ff0000
}

#positioned {
background: #526ea6;
color: ffffff;
width: 60%;
position: absolute;
top: 200px;
left: 20%;
}
[/syntax]
Post Reply