Jump to content

[SOLVED] working on my site, so many hicups, help please?


Recommended Posts

Hi there guys, i have almost done the main page of my new site, i wish i was a coding genious! hence why im here asking you guys!.

 

basically the problem is, on the main page i added a news manager, but its displaying too big than it needs to be, it's only needing to be 844px across to fit in the css template i made and also it shouldnt be that tall, also notice when you scroll down in the box it has the made by bit which used to display at the bottom of the site outside the box,

 

http://www.prettyklicks.com

 

i dont know if you can display the files from the directory there?

 

if i need to alter permissions let me know

 

the root is http://prettyklicks.teenxpats.com

 

cheers guys

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<LINK REL=StyleSheet HREF="styles.css" TYPE="text/css" media="screen">
<script type="text/javascript" src="ufo.js"></script>

<title>pretty|klicks</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="javascript">
function swapImage(imgN,imgU){
if(document.images)document.images[imgN].src=imgU;
}
</script> 


</head>
<body>



<div id="main">


<div class="Table_01">
<div class="TOP1">
	<img src="images/TOP1.gif" width="1000" height="10" alt="">
</div>
<div class="TOP2">
	<img src="images/TOP2.gif" width="474" height="13" alt="">
</div>
<div class="PRODUCTS">
	<a href="http://www.prettyklicks.com/products/" onmouseover="swapImage( 'products' , 'images/PRODUCTSON.gif' )" onmouseout="swapImage( 'products' , 'images/PRODUCTS.gif' )">
<img src="images/PRODUCTS.gif" border="none" name="products">
</a>

        
    </div>
<div class="TOP5">
	<img src="images/TOP5.gif" width="439" height="16" alt="">
</div>
<div class="TOPMENU-3">
	<img src="images/TOPMENU-3.gif" width="328" height="35" alt="">
</div>
<div class="HOME">
	<a href="http://www.prettyklicks.com" onmouseover="swapImage( 'home' , 'images/homeover.gif' )" onmouseout="swapImage( 'home' , 'images/HOME.gif' )">
<img src="images/HOME.gif" border="none" name="home">
</a>

        
    </div>
<div class="TOP4">
	<img src="images/TOP4.gif" width="84" height="35" alt="">
</div>
<div class="TOP6">
	<img src="images/TOP6.gif" width="149" height="32" alt="">
</div>
<div class="GALLERY">
<a href="http://www.prettyklicks.dphoto.com" onmouseover="swapImage( 'gallery' , 'images/GALLERYON.gif' )" onmouseout="swapImage( 'gallery' , 'images/GALLERY.gif' )">
<img src="images/GALLERY.gif" border="none" name="gallery">
</a></div>
<div class="TOP7">
	<img src="images/TOP7.gif" width="228" height="32" alt="">
</div>
<div class="BELOW-PRODUCTS">
	<img src="images/BELOW-PRODUCTS.gif" width="87" height="25" alt="">
</div>
<div class="BELOW-HOME">
	<img src="images/BELOW-HOME.gif" width="62" height="12" alt="">
</div>
<div class="BELOW-GALLERY">
	<img src="images/BELOW-GALLERY.gif" width="62" height="6" alt="">
</div>
<div class="LEFT-MARGIN">
	<img src="images/LEFT-MARGIN.gif" width="73" height="742" alt="">
</div>
<div class="title-bar">
	<img src="images/title-bar.gif" width="844" height="96" alt="">
</div>
<div class="RIGHT-TOP">
	<img src="images/RIGHT-TOP.gif" width="83" height="139" alt="">
</div>
<div class="BAR-1">
	<img src="images/BAR-1.gif" width="844" height="9" alt="">
</div>
<div class="FADER">
<embed 
  src="imagerotator.swf" 
  width="844" 
  height="135" align="middle"
  allowscriptaccess="always" 
  allowfullscreen="false" 
  flashvars="file=imagerotator.xml&transition=lines&shownavigation=false&showicons=false" 
/>
</div>
<div class="RIGHT1">
	<img src="images/RIGHT1.gif" width="34" height="603" alt="">
</div>
<div class="CONTACT">
<a href="http://www.prettyklicks.com/contact" onmouseover="swapImage( 'contact' , 'images/CONTACTON.gif' )" onmouseout="swapImage( 'contact' , 'images/CONTACT.gif' )">
<img src="images/CONTACT.gif" border="none" name="contact">
</a></div>
<div class="RIGHT-2">
	<img src="images/RIGHT-2.gif" width="24" height="603" alt="">
</div>
<div class="RIGHT-3">
	<img src="images/RIGHT-3.gif" width="25" height="530" alt="">
</div>
<div class="BAR-2">
	<img src="images/BAR-2.gif" width="844" height="9" alt="">
</div>
<div class="ABOUT-US-TITLE">
	<img src="images/ABOUT-US-TITLE.gif" width="844" height="45" alt="">
</div>
<div class="ABOUT-US-CONTENT">
<div class="about">
  <div align="right"><br>
      <img src="images/DSC_1.jpg" alt="img" width="300" height="200" border="5" align="right" hspace="10"></img>	  </div>
  <p align="left">	pretty|klicks is a photography service which covers your modern stylish photo needs from the moment they're shot in relaxed optimal conditions to the
     moment they're printed and recieved in your hands. pretty|klicks has come into service due to popular demand. </p>
<p align="left">Started as a hobby, but due to many compliments and popularity the hobby has become pretty|klicks</p>
<p align="left">Photography that doesnt just tell any story, photography that tells your story. Not just any photo a pretty|klicks photo.</p>

    <br><br><br><br>
    
    <div align="left"><br><img src="images/DSC_2.jpg" hspace="10" border="5" align="left">    </div>
    <div align="right"><br><br>
    <p align="left"> Tailor made photography for your needs. It's all about you. Location, weather, objects, people, setting the scene. You choose what youy want. simple. No hassel. Just what you see in your head but better.</p>
    <p align="left"> Want to see whats on offer product whise? Head onto to the 'products' page by clicking <a href="http://www.prettyklicks.com/products">here</a>.</p>
    </div>

 </div>


    <p><br>
    </p>
    <p> </p>
    <p> </p>
</div>
<div class="BAR3">
	<img src="images/BAR3.gif" width="844" height="9" alt="">
</div>
<div class="NEWS-TITLE">
	<img src="images/NEWS-TITLE.gif" width="844" height="40" alt="">
</div>
<div class="NEWS-CONTENT">
    <div class="php">

<? include("mynews.inc.php");?> 
</div>


    
    </div>
   
  </div>
  <br> <div class="bottom" align='center'>
<p aligh='center'>Website owned and created by Stefan Pretty, pretty|klicks 2008-2009</p>
</div>
  <br>
</div>


</body>
</html>

 

AND the included php file:

<?

$dir=substr(__FILE__, 0, strrpos(__FILE__, "/")+1);

// load config
include_once($dir."config.inc.php");
include_once($dir."FCKeditor/fckeditor.php") ;

$dat=$dir."data.dat";						
$templatefile=$dir."templates.inc.php";		
$log=$dir."log.dat.php";							
$pathtowysiwyg=$pathtoscript."wysiwyg/";
setlocale(LC_TIME, $datelang);

$me= $_SERVER['PHP_SELF'];
$empty=false;
$now=time();
$version="1.6.4";

if (!isset($_GET['hash']) || $_GET['hash']=="") {
srand($now);
for ($i=0; $i<16 ; $i++) $secret.=chr(rand(60, 127));
$secret=md5($secret);
$hash=md5($_SERVER['HTTP_USER_AGENT'].$now.$secret);
}else $hash= $_GET['hash'];
$getvars="?hash=$hash";

if (isset($_REQUEST['do'])) 		$do=$_REQUEST['do'];
if (isset($_REQUEST['id'])) 		$id=$_REQUEST['id'];
if (isset($_REQUEST['action'])) 	$action=$_REQUEST['action'];
if (isset($_REQUEST['title'])) 	$title=$_REQUEST['title'];
if (isset($_REQUEST['name'])) 		$name=$_REQUEST['name'];
if (isset($_REQUEST['pwd'])) 		$pwd=$_REQUEST['pwd'];
if (isset($_REQUEST['email'])) 	$email=$_REQUEST['email'];
if (isset($_REQUEST['www'])) 		$www=$_REQUEST['www'];
if (isset($_REQUEST['story'])) 		$story=$_REQUEST['story'];
if (isset($_REQUEST['teaser'])) 		$teaser=$_REQUEST['teaser'];
if (isset($_REQUEST['time'])) 	$time=$_REQUEST['time'];
if (isset($_REQUEST['date'])) 	$date=$_REQUEST['date'];


// ************************** functions ***********************
// ************************************************************


function getkey($index, $stuff){
foreach ($stuff->data as $key => $item){
	if ($item['id']==$index){
		$ret=$key;
		break;	
	}
}
return $ret;
}

function validemail($addr){
return eregi("^[a-z0-9]+([_.-][a-z0-9]+)*@([a-z0-9]+([.-][a-z0-9]+)*)+\\.[a-z]{2,4}$", $addr);
}

function jsRedirect($url){
echo "<script language=\"Javascript\" type=\"text/javascript\">\n<!--\n  location.href='$url'  \n//-->\n</script>";
}

function clearoldadmins() {
global $log, $now, $adminexpire;
include($log);
if (count($admins)>0){
	$i=0;
	$fp=fopen($log, "w");
	fputs($fp, "<?\n");
	foreach ($admins as $line){
		if ($now-$line['time']<$adminexpire)
			fputs($fp, "\$admins[$i]['time']=".$line[time]."; \$admins[$i]['hash']='".$line['hash']."';\n");			
		$i++;
	}
	fputs($fp, "?>");
	fclose($fp);
}
}

function saveposts($stuff){
global $dat;
$fp=fopen($dat, "w");
foreach ($stuff as $item){
	$line=$item['id']."|".$item['time']."|".$item['mode']."|".$item['title']."|".$item['story']."|".$item['teaser']."\n";
	fputs($fp, $line);
}
fclose($fp);
}

function isloggedin() {
global $log, $now, $adminexpire;
include($log);
$logged=false;
if (count($admins)>0){
	foreach ($admins as $line){
		if ($line['hash']==md5($_GET['hash'])) $logged=true;
	}
}
return $logged;
}

function showmenu() {
global $txtsign, $txtview, $txtadmin, $me, $getvars;
echo "<div class='smtxt' style='margin-bottom:8px;'><a href='$me$getvars&do=add'>$txtsign</a> :: <a href='$me$getvars&do=view'>$txtview</a></div>"; 
}

function emailencoder ($str){
for ($i=0; $i< strlen($str); $i++){
	$n=rand(0,10);
	if ($n>5) $foo.="&#".ord($str[$i]).";";
	else $foo.="&#x".sprintf("%X", ord($str[$i])).";";
}
return $foo;	
}

function getTemplate($tpl, $html){
$match="/<\!\-\-$tpl\-\->(.*?)<\!\-\-$tpl\-\->/s";
preg_match($match, $html, $tmp);
return $tmp[1];		
}

if (!function_exists('str_ireplace'))
{
    function str_ireplace ($search, $replace, $subject, $count = null)
    {
        if (is_string($search) && is_array($replace)) {
            trigger_error('Array to string conversion', E_USER_NOTICE);
            $replace = (string) $replace;
        }
        if (!is_array($search)) {
            $search = array ($search);
        }
        if (!is_array($replace))
        {
            $replace_string = $replace;

            $replace = array ();
            for ($i = 0, $c = count($search); $i < $c; $i++)
            {
                $replace[$i] = $replace_string;
            }
        }
        $length_replace = count($replace);
        $length_search = count($search);
        if ($length_replace < $length_search)
        {
            for ($i = $length_replace; $i < $length_search; $i++)
            {
                $replace[$i] = '';
            }
        }
        $was_array = false;
        if (!is_array($subject)) {
            $was_array = true;
            $subject = array ($subject);
        }
        $count = 0;
        foreach ($subject as $subject_key => $subject_value)
        {
            foreach ($search as $search_key => $search_value)
            {
                $segments = explode(strtolower($search_value), strtolower($subject_value));
                $count += count($segments) - 1;
                $pos = 0;
                foreach ($segments as $segment_key => $segment_value)
                {
                    $segments[$segment_key] = substr($subject_value, $pos, strlen($segment_value));
                    $pos += strlen($segment_value) + strlen($search_value);
                }
                $subject_value = implode($replace[$search_key], $segments);
            }
            $result[$subject_key] = $subject_value;
        }
        if ($was_array === true) {
            return $result[0];
        }
        return $result;
    }
}

function paging(
$pages,
$pagevar="page",
$ppv=10, 
$first	="<a href='{url}'>«««</a> ",
$firsts ="««&laquo ",
$prev	="<a href='{url}'>««</a>  ",
$prevs	="««  ",
$num	="<a href='{url}'>{page}</a>",
$nums	="{page}",
$sep	=" | ",
$more	="[<a href='{url}'>...</a>]",
$next	="  <a href='{url}'>»»</a>",
$nexts	="  »»",
$last	=" <a href='{url}'>»»»</a>",
$lasts	=" »»»"){

// get URI parameters			
$getvars=$_SERVER['PHP_SELF']."?";
foreach ($_GET as $key => $val){
	if ($key!=$pagevar){
		if (isset($val) && $val!=""){
			$getvars.="$key=$val&";
		}else{
			$getvars.="$key&";
		}
	}
}

$page=(is_numeric($_GET[$pagevar])) ? $_GET[$pagevar] : 1;
$page=($page>$pages) ? $pages : $page;
$prevpage=($page>1) ? $page-1 : 1;
$nextpage=($page < $pages) ? $page+1 : $pages;
$paging="";

if ($pages>1){
	// first
	$paging.=($page>1) ? str_replace("{url}", "$getvars$pagevar=1", $first) : $firsts;
	// prev
	$paging.=($page>1) ? str_replace("{url}", "$getvars$pagevar=$prevpage", $prev) : $prevs;

	// pages		
	$ppvrange=ceil($page/$ppv);
	$start=($ppvrange-1)*$ppv;
	$end=($ppvrange-1)*$ppv+$ppv;
	$end=($end>$pages) ? $pages : $end;
	$paging.=($start>1) ? str_replace("{url}", "$getvars$pagevar=".($start-1), $more).$sep : "";
	for ($i=1; $i<=$pages; $i++){
		if ($i>$start && $i<= $end){
			$paging.=($page==$i) ? str_replace("{page}", $i, $nums).(($i<$end) ? $sep : "") : str_replace(array("{url}", "{page}"), array("$getvars$pagevar=$i", $i), $num).(($i<$end) ? $sep : "");
		}
	}
	$paging.=($end<$pages) ? $sep.str_replace("{url}", "$getvars$pagevar=".($end+1), $more) : "" ;

	// next
	$paging.=($page<$pages) ? str_replace("{url}", "$getvars$pagevar=$nextpage", $next) : $nexts;
	// last
	$paging.=($page<$pages) ? str_replace("{url}", "$getvars$pagevar=$pages", $last) : $lasts;
}

return $paging;
}

?>
<script language="JavaScript" type="text/javascript">
function addEvent(obj, evType, fn, useCapture){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be attached");
  }
}

function getElement(id){
var obj;
if (document.getElementById){
	obj = document.getElementById(id);	
}else if (document.all){
	obj = document.all.id;	
}
return obj;
}

function toggleStory(chb, id){
var obj = getElement(id);
if (chb.checked){
	obj.style.visibility = "visible";
	obj.style.height = "450px";
}else{
	obj.style.visibility = "hidden";
	obj.style.height = "0";
}
}
</script>


<?

// ************************** MAIN ****************************
// ************************************************************

// init
$foo=file($dat);
$stuff= new mdasort;
$stuff->sortkeys = array(array('time','DESC'));

if (count($foo)==0){
$empty=true;
$nextindex=1;
}else{
$i=0;
foreach ($foo as $line){
	$line=explode("|", rtrim($line));	
	if ($line[2]=="static" || ($line[2]=="dynamic" && $line[1]<$now) || isloggedin() ){
		$stuff->data[$i] = array("id" => $line[0], "time" => $line[1], "mode" => $line[2], "title" => $line[3], "story" => $line[4], "teaser" => $line[5]);
		$i++;
	}
}
if ($i>0){
	$stuff->sortkeys = array(array('id','DESC'));
	$stuff->msort();
	$foo=current($stuff->data);
	$nextindex=$foo['id']+1;
	$stuff->sortkeys = array(array('time','DESC'));
	$stuff->msort();
	$numposts=count($stuff->data);
}else{
	$numposts=0;		
	$empty=true;
}
}

// RSS stuff
if ($rssEnable){
$info = pathinfo($_SERVER['PHP_SELF']);
$info['dirname'] = ($info['dirname'] == "/") ? $info['dirname'] : $info['dirname']."/";
$url = $info['dirname'].$pathtoscript."rss.php?mndo=rss";
echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$rssTitle\" href=\"$url\" />";
}

echo "\n\n<!-- start mynews $version -->\n\n";
echo "<table cellpadding='0' cellspacing='0' border='0' width='100%'><tr><td align='center'>";
clearoldadmins();


// admin stuff
if ($do=="admin") {

if ($action=="login"){
	if ($name==$adminname && $pwd==$adminpwd){
		include($log);

		$fp=fopen($log, "w");
		fputs($fp, "<?\n");
		$i=0;
		if (count($admins)>0){
			foreach ($admins as $line){
				fputs($fp, "\$admins[$i]['time']=".$line[time]."; \$admins[$i]['hash']='".$line['hash']."';\n");			
				$i++;
			}
		}
		fputs($fp, "\$admins[$i]['time']=".$now."; \$admins[$i]['hash']='".md5($hash)."';\n?>");			
		fclose($fp);

		jsRedirect($me.$getvars);
	}
}

if ($action=="delete" && isloggedin()){
	$todel=getkey($id, $stuff);
	unset($stuff->data[$todel]);
	$stuff->msort();
	saveposts($stuff->data);
	$do="view";
}else{
	?>
	<form action="<?=$me.$getvars?>" method="post" name="form2" class="smtxt">
	Admin Login<br><br>
	<table border="0" cellpadding="0" cellspacing="2" class="smtxt">
	<tr><td>Login  </td><td>
	<input name="name" type="text" id="name" size="20">
	</td></tr><tr><td>Password  </td>
	<td><input name="pwd" type="password" id="pwd" size="20"></td>
	</tr><tr><td> </td><td>
	<input type="submit" name="Submit" value="Login">
	<input name="do" type="hidden" id="do" value="admin">
	<input name="action" type="hidden" id="action" value="login">
	</td></tr></table> 
	</form>
	<?
}
}

if (isloggedin()){
showmenu();

if ($do=="add"){
	if ($action=="save"){

		$error=false;
		$saveit=false;
		if ($title=="") $error.="<br>» $txtbadtitle";
		//if ($story=="") $error.="<br>»  $txtbadstory";
		if ($teaser=="") $error.="<br>»  $txtbadteaser";
		if ($date=="") $error.="<br>»  $txtbaddate";

		if ($error===false){

			$date = explode(".", $date);
			$daytime = explode(".", $_REQUEST['daytime']);
			$daytime[0] = (is_numeric($daytime[0]) &&  $daytime[0] >= 0 && $daytime[0] < 24) ? $daytime[0] : 23;
			$daytime[1] = (is_numeric($daytime[1]) &&  $daytime[1] >= 0 && $daytime[1] < 60) ? $daytime[1] : 59;
			$time = mktime($daytime[0], $daytime[1], 0, $date[1], $date[0], $date[2]);
			$story = ($_REQUEST['hasstory'] == 1) ? $_REQUEST['story'] : "";

			if ($id=="new"){
				$index=$numposts;
				$id=$nextindex;					
				$saveit=true;
			}else if (is_numeric($id)){
				$index=getkey($id, $stuff);
				$saveit=true;
			}

			if ($saveit){			
				$stuff->data[$index]['id']=$id;
				$stuff->data[$index]['time']=$time;
				$stuff->data[$index]['mode']=$_REQUEST['mode'];
				$stuff->data[$index]['title']=str_replace(array("|"), array(" "), $title);
				if ($wysiwyg===true){
					$stuff->data[$index]['teaser']=stripslashes(str_replace(array("\r", "\n", "|"), array(" ", " ", " "), $teaser));
					$stuff->data[$index]['story']=stripslashes(str_replace(array("\r", "\n", "|"), array(" ", " ", " "), $story));
				}else{
					$stuff->data[$index]['teaser']=str_replace(array("\r", "\n", "|"), array(" ", "<br>", " "), $teaser);
					$stuff->data[$index]['story']=str_replace(array("\r", "\n", "|"), array(" ", "<br>", " "), $story);
				}
				saveposts($stuff->data);
				$stuff->msort();
				$empty=false;
			}

			$do="view";

		}else echo "<div class='smtxt' style='color:#cc0000;'><b>$txterrors</b>$error<br><br><i>$txtclickback</i></div>";

	}else{
		if ($action=="edit"){
			$post=$stuff->data[getkey($id, $stuff)];
			$title= htmlentities(stripslashes($post['title']), ENT_QUOTES);
			if ($wysiwyg===true){
				$teaser = ($post['teaser']);
				$story = ($post['story']);
			}else{
				$teaser=stripslashes(str_replace("<br>", "\n", htmlentities($post['teaser'], ENT_QUOTES)));
				$story=stripslashes(str_replace("<br>", "\n", htmlentities($post['story'], ENT_QUOTES)));
			}
			$time=$post['time'];
			$mode = $post['mode'];
			$hasstory = (trim($story) != "") ? true : false;
		}else{
			$title="";
			$story="";
			$time="notset";
			$id="new";
			$mode = "dynamic";
			$hasstory = true;
		}

		?>
		<form name="form1" method="post" action="<?=$me.$getvars?>" onSubmit="return submitForm();">
		<table border="0" cellpadding="2" cellspacing="0" class="smtxt">
		<tr>
		<td width="65">Date </td>
		<td>
		<input name="date" type="text" id="date" value="<?=date("d.m.Y", ($time=="notset") ? time() : $time);?>" style="width:100px;" maxlength="10"> [dd.mm.yyyy]   
		<input name="daytime" type="text" id="time" value="<?=date("H.i", ($time=="notset") ? time() : $time);?>" style="width:80px;" maxlength="5"> [hh.mm]
		</td>
		</tr>
		<tr>
		<td>Mode </td>
		<td>
		<div style="float:left; padding-top:3px;">
		<input name="mode" type="radio" value="dynamic" id="dynamic" style="vertical-align:-3px;" <?=($mode=="dynamic") ? "checked" : ""?>/><label for="dynamic">dynamic</label>   
		<input name="mode" type="radio" value="static" id="static" style="vertical-align:-3px;" <?=($mode=="static") ? "checked" : ""?>/><label for="static">static</label> 
		</div>
		<div style="float:right; text-align:right; font-size:10px;">
		<strong>dynamic</strong> = news aren't shown when date is in future<br />
		<strong>static</strong> = news are always shown
		</div>
		</td>
		</tr>
					<tr>
		<td>Title </td>	
		<td>
		<input name="title" type="text" id="title" value="<?=$title?>" style="width:500px;" >
		</td></tr>

		<!-- Teaser -->
		<tr>
		<td valign="top">Teaser 
		</td><td>
		<div class="rte">
		<? if ($wysiwyg===true){ 


			$oFCKeditor = new FCKeditor('teaser') ;
			$oFCKeditor->BasePath = $pathtoscript.'FCKeditor/';
			$oFCKeditor->Value = $teaser;
			$oFCKeditor->Width = "100%";
			$oFCKeditor->Height = 300;

			$oFCKeditor->Create() ;




		 } else { ?>
			<textarea name="teaser" cols="50" rows="5" id="story" style="width:500px"><?=$teaser?></textarea>
		<? }?>
		</div>
		</td></tr>

		<!-- Story -->
		<tr>
			<td valign="top"> 
			</td>
			<td>
			<input name="hasstory" type="checkbox" id="hasstory" value="1" <?=($hasstory === true) ? "checked" : ""?> style="vertical-align:-3px;" onChange="toggleStory(this, 'rowStory');"/>
			<label for="hasstory">has story</label> 
			</td>
		</tr>


		<tr>
			<td colspan="2" valign="top" style="padding:0px;">

				<div id="rowStory">
				<table border="0" cellpadding="2" cellspacing="0" class="smtxt" width="100%">	
				<tr>
				<td width="65" valign="top">Story 
				</td><td>
				<div class="rte">
				<? if ($wysiwyg===true){ 

					$oFCKeditor = new FCKeditor('story') ;
					$oFCKeditor->BasePath = $pathtoscript.'FCKeditor/';
					$oFCKeditor->Value = $story;
					$oFCKeditor->Width = "100%";;
					$oFCKeditor->Height = 450;
					$oFCKeditor->Create() ;

				 } else { ?>
					<textarea name="story" cols="50" rows="5" id="story" style="width:500px"><?=$story?></textarea>
				<? }?>
				</div>
				</td>
				</tr>
				</table>
				</div>

				<script language="JavaScript" type="text/javascript">
				addEvent(window, 'load', toggleStory(getElement('hasstory'), 'rowStory'));
				</script>


			</td>
		</tr>


		<tr><td> </td><td>
		<input type="submit" name="Submit" value="<?=($id=="new") ? "Add" : "Save"?>">
		<input name="do" type="hidden" id="do" value="add">
		<input name="action" type="hidden" id="action" value="save">
		<input name="id" type="hidden" id="id" value="<?=$id?>">
		</td></tr>
		</table>
		</form>
		<?
	}
}
}


// display posts
if ($do=="view" || !isset($do)){
if (!$empty){

	$templates = implode("", file($templatefile));
	$tpl_teaser = getTemplate("TEASER", $templates);
	$tpl_story = getTemplate("STORY", $templates);

	// show full story of specific news
	if (is_numeric($_GET['mnid'])){

		$item = $stuff->data[getkey($_GET['mnid'], $stuff)];
		$item['title'] = stripslashes($item['title']);
		$item['teaser'] = stripslashes($item['teaser']);
		$item['story'] = stripslashes($item['story']);

		if ($wrap!==false) $item['story']=wordwrap($item['story'], $wrap, " ", 1);
		$match=array("{title}", "{time}", "{teaser}", "{story}", "{edit}", "{delete}", "{urltoallnews}");
		if (isloggedin()){
			$replace=array( $item['title'], 
							strftime($dateformat, $item['time']), 
							$item['teaser'], 
							$item['story'], 
							"<a href='$me$getvars&do=add&action=edit&id=".$item['id']."'>$txtedit</a>", 
							"<a href='$me$getvars&do=admin&action=delete&id=".$item['id']."&page=".$_GET['page']."'>$txtdelete</a>", 
							"$me$getvars&page=".$_GET['page']);
		}else $replace=array($item['title'], strftime($dateformat, $item['time']), $item['teaser'], $item['story'], "", "", "$me$getvars&page=".$_GET['page']);

		$tmp = str_replace($match, $replace, $tpl_story);
		ob_start();
		eval("?>".$tmp."<?");
		$tmpparsed = ob_get_contents();
		ob_end_clean();
		$html .= $tmpparsed;		

		echo stripslashes($html);


	// show all news
	}else{		
		$i=1;
		$from=(is_numeric($_GET['page'])) ? (($_GET['page']-1)*$ppp)+1 : 1;
		foreach($stuff->data as $item){
			if ($item['id']!=0 && $i>=$from && $i< ($from+$ppp) ){

				$item['title'] = stripslashes($item['title']);
				$item['teaser'] = stripslashes($item['teaser']);
				$item['story'] = stripslashes($item['story']);
				$hasstory = (trim($item['story']) != "") ? true : false;

				if ($wrap!==false) $item['story']=wordwrap($item['story'], $wrap, " ", 1);
				$match=array("{title}", "{time}", "{teaser}", "{story}", "{edit}", "{delete}", "{urltofullstory}");
				if (isloggedin()){
					$replace=array( $item['title'], 
									strftime($dateformat, $item['time']), 
									$item['teaser'], 
									$item['story'], 
									"<a href='$me$getvars&do=add&action=edit&id=".$item['id']."'>$txtedit</a>", 
									"<a href='$me$getvars&do=admin&action=delete&id=".$item['id']."&page=".$_GET['page']."'>$txtdelete</a>", 
									($hasstory === true) ? "$me$getvars&mnid=".$item['id']."&page=".$_GET['page'] : ""
									);
				}else{
					$replace = array($item['title'], 
									 strftime($dateformat, 
									 $item['time']), 
									 $item['teaser'], 
									 $item['story'], 
									 "", 
									 "", 
									 ($hasstory === true) ? "$me$getvars&mnid=".$item['id']."&page=".$_GET['page'] : ""
									 );
				}					
				$tmp = str_replace($match, $replace, $tpl_teaser);
				ob_start();
				eval("?>".$tmp."<?");
				$tmpparsed = ob_get_contents();
				ob_end_clean();
				$html .= $tmpparsed;		
			}		
			$i++;
		}
		echo stripslashes($html);
		$numpages=(fmod($numposts,$ppp)>0) ? floor($numposts/$ppp)+1 : ($numposts/$ppp);
		echo "<div class='smtxt'><br>";
		echo paging($numpages);
		echo "</div><br>";
	}
}	
}


// closing table tags

echo "</td></tr><tr class='smtxt'><td align='center' class='smsmall' height='20' valign='bottom'>";
if (!isloggedin()) echo "<a href='$me$getvars&do=admin'>$txtadmin</a> - ";
else echo "<a href='$me'>$txtlogout</a> - ";
?>

 

 

 

I worked it out it's all good it was simply the order in which i had placed the div tag of the bottom of the page, the php include was thinking that that was part of it, and was messing up the alignments.... got it now though!

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.