Jump to content

CSS formatting with PHP


whare

Recommended Posts

This is abit of both css and php

 

Demo Link: http://www.doveclix.com/index.php?view=click1&

 

what i am trying todo is get them to list

 

AD1 AD2

AD3 AD4

 

but currently the just vertical list now it needs todo it within its relevant category i did try

 

style=\"float:".(($x%2==1)?"right":"left").";

and worked ok when categories are not used however with the method i want to use it pushes the Opulentia link in cat C to the right

 

here is the code guys

 

<?php
//###########################################################################
//#       AURORAGPT Script Copyright owned by Mike Pratt and John Terrell   #
//#                        ALL RIGHTS RESERVED 2007-2014                    #
//#                                                                         #
//#        Any illegal use of this script is strictly prohibited unless     # 
//#        permission is given by the owner of this script.  To sell        # 
//#        this script you must have a resellers license. Your site         #
//#        must also use a unique encrypted license key for your            #
//#        site. Your site must also have site_info module and              #
//#        key.php file must be in the script unedited. Otherwise           #
//#        it will be considered as unlicensed and can be shut down         #
//#        legally by Illusive Web Services. By using AuroraGPT             #
//#        script you agree not to copy infringe any of the coding          #
//#        and or create a clone version is also copy infringement          #
//#        and will be considered just that and legal action will be        #
//#        taken if neccessary.                                             #
//#########################################################################//   
//**VS**//$setting[ptc]//**VE**//
if($settings[ptcon] == 1) {
//**S**//
if($type == "") 	$type="DESC";
if($type == "DESC") 	$newtype="ASC";
if($type == "ASC") 	$newtype="DESC";

if($orderby == "") 	$orderby="pamount";
$order[$orderby]="<img src=\"images/"."$type".".gif\" border=0>";

$totalptc=0;
$y=0;
if(!$LOGGED_IN) {

$sql = $Db1->query("SELECT * FROM ads WHERE 
 credits>=1 
and active=1
and (daily_limit>views_today or daily_limit=0)
and (upgrade='' or upgrade='1')
ORDER BY $orderby $type
");	
$totalptc = $Db1->num_rows();
}

if($LOGGED_IN) {

$clickHistory = loadClickHistory($username, "ptc");

if($thismemberinfo['type'] == 1) { $eb = intval($Db1->querySingle("SELECT eb_ptc as total FROM memberships WHERE id='{$thismemberinfo['membership']}' ","total")); }

$sql = $Db1->query("SELECT * FROM ads WHERE 
	credits>=1 
	and active=1
	and (daily_limit>views_today or daily_limit=0)
	and (upgrade='0' ".($thismemberinfo[type]==1?" or upgrade='1'":"").")
	ORDER BY $orderby $type
");	
}








$totalptc=0;
if($Db1->num_rows() > 0) {
for($x=0; $ad=$Db1->fetch_array($sql); $x++) {
	//$cont = $ad[country];
	//$tstring = explode(',' , $cont);
	//if ((in_array("$thismemberinfo[country]",$tstring)) || ($ad[country]=="")) {
		$cont = $ad[country];
		$tstring = explode(',' , $cont);
		if ((in_array("$thismemberinfo[country]",$tstring)) || ($ad[country]=="")) {
			if(findclick($clickHistory, $ad['id']) == 0) {
				$totalptc++;

				$tempcodep="


<div class=ptclink style=\"background-color: $ad[bgcolor] !important;\" id=\"col$x\">
						<center>

    <a href=\"gpt.php?v=entry&type=ptc&id=$ad[id]&".$url_variables."\" target=\"_blank\" onclick=\"clicked1('col$x');\"><b>".parse_link(ucwords(strtolower(stripslashes($ad[title]))))."</b>
".iif($ad['targetban']!="","<br><img src=\"$ad[targetban]\"width=\"245\" border=\"0\">")."".iif($ad['targetban']==0 ,"")."
						".iif($ad['subtitle_on'] && $ad['subtitle']!="","<br/><em>".strtolower(html_entity_decode($ad['subtitle']))."</em>")."</a><br>
<div class=linktext><div class=textlink><i> $ad[timed] Sec.</i><br>
".iif($ad['class']=="P","$ad[pamount] Points","$settings[currency]$ad[pamount]")."</div></div>
  </center> </div>" 

;

$tempcodeb="


<div class=ptclink id=\"col$x\">
						<center>

    <a href=\"gpt.php?v=entry&type=ptc&id=$ad[id]&".$url_variables."\" target=\"_blank\" onclick=\"clicked1('col$x');\"><b>".parse_link(ucwords(strtolower(stripslashes($ad[title]))))."</b>
".iif($ad['targetban']!="","<br><img src=\"$ad[targetban]\"width=\"245\" border=\"0\">")."".iif($ad['targetban']==0 ,"")."
						".iif($ad['subtitle_on'] && $ad['subtitle']!="","<br/><em>".strtolower(html_entity_decode($ad['subtitle']))."</em>")."</a><br>
<div class=linktext><div class=textlink><i> $ad[timed] Sec.</i><br>
".iif($ad['class']=="P","$ad[pamount] Points","$settings[currency]$ad[pamount]")."</div></div>
  </center> </div>" 

;
$tempcodec="


<div class=ptclink id=\"col$x\" style='height:100px;'>
						<center>

    <a href=\"gpt.php?v=entry&type=ptc&id=$ad[id]&".$url_variables."\" target=\"_blank\" onclick=\"clicked1('col$x');\"><b>".parse_link(ucwords(strtolower(stripslashes($ad[title]))))."</b>
						".iif($ad['subtitle_on'] && $ad['subtitle']!="","<br/><em>".strtolower(html_entity_decode($ad['subtitle']))."</em>")."</a><br>
<div class=linktext><div class=textlink><i> $ad[timed] Sec.</i><br>
".iif($ad['class']=="P","$ad[pamount] Points","$settings[currency]$ad[pamount]")."</div></div>
  </center> </div>" 

;$tempcoded="


<div class=ptclink id=\"col$x\">
						<center>

    <a href=\"gpt.php?v=entry&type=ptc&id=$ad[id]&".$url_variables."\" target=\"_blank\" onclick=\"clicked1('col$x');\"><b>".parse_link(ucwords(strtolower(stripslashes($ad[title]))))."</b>
</a><br>
<div class=linktext><div class=textlink><i> $ad[timed] Sec.</i><br>
".iif($ad['class']=="P","$ad[pamount] Points","$settings[currency]$ad[pamount]")."</div></div>
  </center> </div>" 

;
if($ad['class'] == "P") $classp= "<h2>Admin Ads</h2>";
if($ad['class'] == "A") $classa= "<h2>A</h2>";
if($ad['class'] == "B") $classb= "<h2>B</h2>";
if($ad['class'] == "C") $classc= "<h2>C</h2>";
if($ad['class'] == "D") $classd= "<h2>D</h2>";

		if($ad['class'] == "P" && $ad[upgrade]==1) { $adsp1.=$tempcodep; } else { 
		if($ad['class'] == "P") $adsp.=$tempcodep; }

		if($ad['class'] == "A" && $ad[upgrade]==1) { $adsa1.=$tempcodep; } else { 
		if($ad['class'] == "A") $adsa.=$tempcodep; }

		if($ad['class'] == "B" && $ad[upgrade]==1) { $adsb1.=$tempcodeb; } else { 
		if($ad['class'] == "B") $adsb.=$tempcodeb; }

		if($ad['class'] == "C" && $ad[upgrade]==1) { $adsc1.=$tempcodec; } else { 
		if($ad['class'] == "C") $adsc.=$tempcodec; }

		if($ad['class'] == "D" && $ad[upgrade]==1) { $adsd1.=$tempcoded; } else { 
		if($ad['class'] == "D") $adsd.=$tempcoded; }


//			if($ad['class'] == "A") $adsa2.=$tempcode;
//			if($ad['class'] == "B") $adsb2.=$tempcode;
//			if($ad['class'] == "C") $adsc2.=$tempcode;
//			if($ad['class'] == "D") $adsd2.=$tempcode;



//					if($ad[upgrade] == 1) $adsp1.=$adsp2;
//					else $adsp.=$adsp2;
//					if($ad[upgrade] == 1) $adsa1.=$adsa2;
//					else $adsa.=$adsa2;
//					if($ad[upgrade] == 1) $adsb1.=$adsb2;
//					else $adsb.=$adsb2;
//					if($ad[upgrade] == 1) $adsc1.=$adsc2;
//					else $adsc.=$adsc2;
//					if($ad[upgrade] == 1) $adsd1.=$adsd2;
//					else $adsd.=$adsd2;
			}
		}
	//}
}
}

if($thismemberinfo[type] != 1 && $settings[showPremOnlyMsg]) {
$sql = $Db1->query("SELECT COUNT(id)as total FROM ads WHERE credits>=1 and active='1' and (daily_limit>views_today or daily_limit=0) and upgrade='1' ");
$upgradeOnly = $Db1->fetch_array($sql);
if($upgradeOnly[total] > 0) {
	$showmsg="<div style=\"background-color: pink; border: 1px solid red; margin: 10px;\">Upgrade to a premium account to access more advertisements. There are currently ".$upgradeOnly[total]." premium-only ads available!</div>";
}
}

$includes[title]="Get Paid To Click";

$includes[content].="

<script>
function clicked1(colid) {
document.getElementById(colid).style.display='none';
document.getElementById('refwarn').style.display='';
}
</script>

".iif($totalptc>0, "
<table width=\"100%\" cellpadding=0 cellspacing=0>
	<tr>
		<td align=\"left\">$totalptc Links Available To Click</td><td align=\"right\"><div align=\"right\">
".iif($settings[surfalllinks],"<a href=\"gpt.php?v=entry&type=ptc&s=1&".$url_variables."\" style=\"font-size: 15pt;\">Surf These Links</a>")."     </div></td>
	</tr>
</table>

<table width=\"100%\">
".iif($settings[min_clicks_required]>0,"
<tr>
<td><center><font color=\"darkred\"><b>NOTE: Members must click at least $settings[min_clicks_required] PTC Ads today to earn from their refferals tomorrow!</b></font></center></td>
</tr>")."
".iif($settings[premium_ref_earnings]>0,"
<tr>
<td><center><font color=\"darkgreen\"><b>Upgraded Members do not have to click any ads to receive earnings from their referrals.</b></font></center></td>
</tr>")."
</table>
".iif($settings[ptc_list],"
	<div class=\"ptcWrapper\">
<table width=100% border=0><tr><td>
$classp
				$adsp1
				$adsp</td></tr><tr><td>
$classa
				$adsa1
				$adsa</td></tr><tr><td>
$classb
				$adsb1
				$adsb</td></tr><tr><td>
$classc
				$adsc1
				$adsc</td></tr><tr><td>
$classd
				$adsd1
				$adsd</td></tr><tr><td>






</td></tr></table>
	</div>
	$showmsg

")."

<p>
<b>Rules</b><br />
<small>You Can Only Visit One Site At A Time<br />
<strong>You MUST Click The Correct Button After The Timer Runs Out</strong></small>
</p>

","<p>There are no links available to click!</p>")."

";
}
else {
$includes[content]="PTC is currently disabled by admin!";
}

?>

 

CSS

.ptclink {
/*height: 5em;*/
width: 270px;
-moz-border-radius: 1em 4em 1em 4em;
border-radius: 1em 4em 1em 4em;
background-color: #e8e8e8;
border: 2px dashed #ab0224;
margin:7px;
}

.linktext
  {
  width:70px;
  /*height:180px;*/
  margin:5px 5px;
-moz-border-radius: 1em 1em 1em 1em;
border-radius: 1em 1em 1em 1em;
  background-color:#ab0224;
  border:1px solid #ab0224;
  /* for IE */
  filter:alpha(opacity=60);
  /* CSS3 standard */
  opacity:0.6;
  }
.textlink
{
  font-weight:bold;
  color:#ffffff;
}

 

PLEASE EXCUSE THE DEAD CODE IN THE PHP I HAVE NOT CLEANED IT UP YET

 

Thanx all hope somebody can help with it

Link to comment
Share on other sites

First off, I would suggest using a class instead of inline styles. That way you can easily change a page layout without having to touch the PHP code. I think the problem is that you don;t want to use a float right - only the float left. Try using:

style=\"".(($x%2==1)?"":"float:left").";

 

Edit: this really isn't a PHP question. Moving to the CSS forum. You should "test" your layout first usign mock pages with mock data. Once you have it in the format you want - THEN write the PHP to replicate it.

Link to comment
Share on other sites

First off, I would suggest using a class instead of inline styles. That way you can easily change a page layout without having to touch the PHP code. I think the problem is that you don;t want to use a float right - only the float left. Try using:

style=\"".(($x%2==1)?"":"float:left").";

 

Edit: this really isn't a PHP question. Moving to the CSS forum. You should "test" your layout first usign mock pages with mock data. Once you have it in the format you want - THEN write the PHP to replicate it.

 

I tried with the

style=\"".(($x%2==1)?"":"float:left").";

the formatting just went mayhem all the boxes overlapped :(

http://www.doveclix.com/index.php?view=click1&

this is not the live page that is located @ http://www.doveclix.com/index.php?view=click& where

style=\"float:".(($x%2==1)?"right":"left").";

is still in use

 

and sorry for posting in the wrong section and thank you for moving it

Link to comment
Share on other sites

OK, as I said build the page with just mock content as a hard coded HTML file. Once you get the CSS and layout the way you want, then create the PHP code to generate the same way. So, at this point I suggest giving it a go with the hard coded page. Then if you can't get it the way you want post the code you have here and ask for help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.