PHP - Text To Html Codes
Similar Tutorialsi need help here..i want to echo a lage code of html but it is giving me problems..i know it will hv to do with the syntax but am confused on how to go about it..below is the php code and the html codes Code: [Select] <?php include"header.php"; session_start(); if(isset($_POST['submit'])) { $log=mysql_real_escape_string($_POST['mail1']); $pas=($_POST['pass1']); if($log=='' || $pas=='') { echo "Please supply your Username(your email address) and your password"; } else { $sel="SELECT user_name,userID FROM user WHERE (user_email='$log') AND (user_password='$pas')"; $ok=mysql_query($sel) or die(mysql_error()); if(mysql_num_rows($ok)==0)echo"Wroung Username or Password used,Please try again"; else { while($row=mysql_fetch_array($ok)) { $_SESSION['userID']=$row['userID']; $_SESSION['user_name']=$row['user_name']; $_SESSION['user_date']=$row['user_date']; echo $_SESSION['user_date']=$row['user_date']; echo"this is where i want to put the html codes so that the user_name appears on the page".$_SESSION['user_name']; } } } } mysql_close(); ?>this is the html codes Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta name="Description" content="Information architecture, Web Design, Web Standards." /> <meta name="Keywords" content="your, keywords" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="Distribution" content="Global" /> <meta name="Author" content="Erwin Aligam - ealigam@gmail.com" /> <meta name="Robots" content="index,follow" /> <link rel="stylesheet" href="images/PixelGreen.css" type="text/css" /> <title>Planetafric</title> </head> <body> <!-- wrap starts here --> <div id="wrap"> <div id="header"><div id="header-content"> <h1 id="logo"><a href="index.html" title="">speak<span class="gray">out</span></a></h1> <h2 id="slogan">The Revolution is now...</h2> <!-- Menu Tabs --> <ul> <li><a href="index.html" id="current">Home</a></li> <li><a href="index.html">News</a></li> <li><a href="index.html">Downloads</a></li> <li><a href="index.html">Support</a></li> <li><a href="index.html">About</a><li> </ul> </div></div> <div class="headerphoto"></div> <!-- content-wrap starts here --> <div id="content-wrap"><div id="content"> <div id="sidebar" > <div class="sidebox"> <h1>About this Website</h1> <p>Due to the injustice we face conitnualy in this nation WE (KTECHGROUP) have decided to stamp our feet against all this ills in our country..THE TIME IS NOW ..Stand against non avalabitlty of social amenities, stand against unemployment and stand against corruption.<img src="speakout_1.png"/></p> </div> <div class="sidebox"> <h1 class="clear">Sidebar Menu</h1> <ul class="sidemenu"> <li><a href="index.html" class="top">Home</a></li> <li><a href="#TemplateInfo">Template Info</a></li> <li><a href="#SampleTags">Sample Tags</a></li> <li><a href="http://www.styleshout.com/">More Templates...</a></li> <li><a href="http://www.4templates.com/?aff=ealigam">Premium Templates</a></li> </ul> </div> <div class="sidebox"> <h1>Sponsors</h1> <ul class="sidemenu"> <li><img src="watch.jpg"/></br><h3>Longinnes wrist watch forsale at reduced price</h3></li> <li><img src="htc.jpg"/><label>4templates</label</li> <li><a href="http://store.templatemonster.com/?aff=ealigam">TemplateMonster</a></li> <li><a href="http://www.fotolia.com/partner/114283">Fotolia.com</a></li> <li><a href="http://www.text-link-ads.com/?ref=40025">Text Link Ads</a></li> </ul> </div> <div class="sidebox"> <h1>Wise Words</h1> <p>"No man can live happily who regards himself alone; who turns everything to his own advantage. You must live for others if you wish to live for yourself."</p> <p class="align-right">- Seneca</p> </div> <div class="sidebox"> <h1>Support Speakout</h1> <p>If you are interested in supporting this work and would like to contribute, you are welcome to make a small donation through the <a href="http://www.styleshout.com/">donate link</a> on this website - it will be a great help and will surely be appreciated.</p> </div> <div class="sidebox"> <h1>Search Box</h1> <form action="#" class="searchform"> <p> <input name="search_query" class="textbox" type="text" /> <input name="search" class="button" value="Search" type="submit" /> </p> </form> </div> </div> <div id="main"> <div class="post"> <a name="TemplateInfo"></a> <h1> </h1> <p>Posted by <a href="index.html">Adetoye Oni</a></p> <p><strong>A weeping Eye</strong> is a free, W3C-compliant, CSS-based website template by <strong><a href="http://www.styleshout.com/">styleshout.com</a></strong>.<p align="left"><img src="soldier_crying.jpg"/></p align> This work is distributed under thel;kmbkl;;lsjljhl;hjklghl;kk;gjhflk;jfgkl;jflhjflkhlkkjgfklk Creative Commons Attribution 2.5 License</a>, which means that you are free to use and modify it for any purpose. All I ask is that you include a link back tohjsklvjksjkskjvskdv dhlkdhlshdlkjhdslkjhkljsdhjsdhjlghdsjhjkdshgjkdhjkshdjkhdsjkhdkjsjgdgl sddjgkldsjlkgdlkshgldhsgldhlghdlshgdlhgldhlkhdlkdkhdlkgdgd djkdjklgdjklgjdslkjdlksjkldsjkldsjlkdsjklgjsldkjgkldsgdsgjdklsgjsljgl\ksdjgjldkgj;ldsk\jglkdsg <a href="http://www.styleshout.com/">my website</a> in your credits.</p> <p>For more free designs, you can visit <a href="http://www.styleshout.com/">my website</a> to see my other works.</p> <p>Good luck and I hope you find my free templates useful!</p> <p class="post-footer align-right"> <a href="index.html" class="readmore">Read more</a> <a href="index.html" class="comments"><?php if(isset($_SESSION['views'])) $_SESSION['views']=$_SESSION['views']+1; else $_SESSION['views']=1; echo"Comments:".$_SESSION['views']; ?></a> <span class="date">Nov 11, 2006</span> </p> </div> <h3>Comments:</h3> <table> <tr class="row-a"> <td class="first"><?php include"header.php"; $sql="SELECT *FROM post "; $result=mysql_query($sql)or die(mysql_error()); while($row=mysql_fetch_array($result)) { echo"{$row['post_date']}"."</br>"; } ?></td> <td><?php include"header.php"; $sql="SELECT *FROM post "; $result=mysql_query($sql)or die(mysql_error()); while($row=mysql_fetch_array($result)) { echo"{$row['post_content']}"."</br>"; } ?></td> </tr> </table> <h3>Post your comments here</h3> <form action='reply.php'method='post'> <textarea name="comment" id="content" style="width:400px;height:50px;background-color:#D0F18F;color:#000000;font:15px/20px cursive;scrollbar-base-color:#638E0D;"></textarea> <br /> <input class="button" type="submit"name="submit"value="submit" /> </p> </form> <br /> </div> <!-- content-wrap ends here --> </div></div> <!-- footer starts here --> <div id="footer"><div id="footer-content"> <div class="col float-left"> <h1>Site Partners</h1> <ul> <li><a href="http://www.dreamhost.com/r.cgi?287326"><strong>Dreamhost</strong> - Affordable & Reliable Webhosting</a></li> <li><a href="http://www.4templates.com/?aff=ealigam"><strong>4templates</strong> - Low Cost Hi-Quality Templates</a></li> <li><a href="http://store.templatemonster.com/?aff=ealigam"><strong>TemplateMonster</strong> - Best templates on the net!</a></li> <li><a href="http://www.fotolia.com/partner/114283"><strong>Fotolia</strong> - Free stock images or from $1</a></li> <li><a href="http://www.text-link-ads.com/?ref=40025"><strong>Text Link Ads</strong> - Easiest. Money. Ever.</a></li> </ul> </div> <div class="col float-left"> <h1>Links</h1> <ul> <li><a href="http://www.openwebdesign.org/">openwebdesign.org</a></li> <li><a href="http://www.opendesigns.org/">Opendesigns.org</a></li> <li><a href="http://www.pdphoto.org/">PDPhoto.org</a></li> <li><a href="http://www.alistapart.com">Alistapart</a></li> <li><a href="http://www.cssremix.com">CSS Remix</a></li> </ul> </div> <div crrlass="col2 float-right"> <p> © copyright 2006 <strong>Ktech group</strong><br /> Programme by: <a href="index.html"><strong>Adeleye Caleb</strong></a> Valid <a href="http://jigsaw.w3.org/css-validator/check/referer"><strong>CSS</strong></a> | <a href="http://validator.w3.org/check/referer"><strong>XHTML</strong></a> </p> <ul> <li><a href="index.html"><strong>Home</strong></a></li> <li><a href="index.html"><strong>Sitemap</strong></a></li> <li><a href="index.html"><strong>RSS Feed</strong></a></li> </ul> </div> </div></div> <!-- footer ends here --> <!-- wrap ends here --> </div> </body> </html> Thanks in advance and this is the html how can i use die but still continue with the html in the rest of code instead of stopping all codes from where die is initiated. i want to die (insert into database) but then still allow the html codes below the die function to work still. \= Aloha, I am using a simple html form and php script to send data to a SMS gateway that I have setup already. Everything works great. I fill out the form, the data is sent and instantly I get a text message on my iphone. Here's the problem. If I use an apostrophe in the message text field I get an error code. I am assuming the html text field needed to be escaped but I tried everything and I still get the error. Any ideas on what to check or do? Here's the php send code (variables coming in from html form fields): Code: [Select] <?php if (!empty($_POST)) { $name = trim($_POST["name"]); $contactnumber = trim($_POST["contactnumber"]); $message = trim($_message); if (empty($name)) { exit("Name cannot be blank."); } if (empty($contactnumber)) { exit("Please provide a contact number."); } if (empty($message)) { exit("Message cannot be blank."); } $subject = "$name . $contactnumber"; $strlen_subject = ($subject != "") ? strlen($subject) + 3 : 0; $strlen_message = strlen($message); $express = $_POST["express"]; if ($express && ($strlen_subject + $strlen_message > 160)) { exit("In case of express delivery, message length should not exceed 160 characters."); } elseif ($strlen_subject + $strlen_message > 130) { exit("In case of standard delivery, message length should not exceed 130 characters."); } $subject = urlencode($subject); $contactnumber = urlencode($contactnumber); $message = urlencode($message); $ch=curl_init('https://app.eztexting.com/api/sending'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,"user=PuaDog&pass=808cougar&phonenumber=18087211458&subject=$subject&message=$message&express=1"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $data = curl_exec($ch); switch($data) { case 1: header('location:message_sent.php?message1=1'); break; case -1: print("Invalid user or password"); break; case -2: print("Credit Limit Reached"); break; case -5: print("Local Opt Out"); break; case -7: print("Invalid Message"); break; case -104: print("Globally Opted Out Phone Number"); break; case -106: print("Incorrectly Formatted Phone Number"); break; case -10: print("Unknown Error"); break; } } ?> Mahalo! Tom MOD Edit: [code] . . . [/code] tags added . . . Hello, I have been trying to come up with bar codes in php to represent integers for example 7432973853. How do I get a bar code for a particular string of numbers? Well my forum code is almost complete and one feature it is lacking is BB Codes. How would I go about making BB Codes for the following: Code: [Select] [URL=Url]Title[/URL] [IMG]Img Url[/IMG] [b]bold[/b] [i]Italics[/i] [u]Underline[/u] [s]Strike-through[/s] These are the only ones I want atm so any help would be appreciated. hello freinds, iam new to this forum and new to php. i have just finished a course on html and css. but now i have realised that its become comulsory for me to learn php. but iam confused as to what ellements of php i should learn. since this is a programming language i find its gonna be real tuff for me, can u please advise as to which parts i should learn first to get going. i wont be developing custom websites for customers, just for my own hobbies. my main ambition is to utilise API's in my websites. Thanx Hellow every one; i need little help to change code in my script version as i have older version codes and em using new version script so i need to change codes on my version script. iam using latest script which codes are these Quote if ($CURUSER['control_panel'] == 'yes' && $privacylevel == 'strong') print('<td class="f-border comment-details" align="left" width="15%"><center><strong>'.$postername.'</strong><br /><i>'.$title.'</i><br /><img width="80" height="80" src="'.$avatar.'"><br /><br />Uploaded: ---<br />Downloaded: ---<br />Ratio: ---<br /><br /><a href="account-details.php?id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_profile.gif"></a> <a href="mailbox.php?compose&id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_pm.gif" ></a></center></td>'); and Quote else print('<td class="f-border comment-details" align="left" width="15%"><center><strong>'.$postername.'</strong><br /><i>'.$title.'</i><br /><img width="80" height="80" src="'.$avatar.'"><br /><br />Uploaded: '.$useruploaded.'<br />Downloaded: '.$userdownloaded.'<br />Ratio: '.$userratio.'<br /><br /><a href="account-details.php?id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_profile.gif"></a> <a href="mailbox.php?compose&id='.$row["user"].'"><img src="themes/'.$THEME.'/forums/icon_pm.gif" ></a></center></td>'); and i want to change them under Quote if ($row["class"] == 3 || $row["donated"] > 0) { if ($site_config["donatedstar"] || $site_config["vipstar"]) { $star = "<img src=images/star.gif border=0>"; } else { $star = ""; } } if ($privacylevel != "strong" || ($CURUSER["control_panel"] == "yes")) { print("<tr><td valign=top width=150 align=left class=table_col2><center><b>$postername $star</b><br><i>$title</i></center><br>Uploaded: $useruploaded<br>Downloaded: $userdownloaded<br>Ratio: $userratio<br><br><center><img width=80 height=80 src=$avatar></center><br></td>"); and Quote }else{ print("<tr><td valign=top width=150 align=left class=table_col2><center><b>$postername $star</b><br><i>$title</i></center><br>Uploaded: ---<br>Downloaded: ---<br>Ratio: ---<br><br><center><img width=80 height=80 src=$avatar></center><br></td>"); } and one more thing i have two different images for both classes as in older codes version only one image specify for both class but em using two images for "Donated" = start.gif and for "VIP" = vip.gif so i want both images for both class so pls help me how to do them. Thanks, Regards. Hi, below is the output from FMS streams in XML format. and there is no way i can change the format of XML file, how do it just get just codes( like 20p5tc0bqm25an2, 42fem6h84kq3nmb, etc) Thank you <?xml version="1.0" encoding="utf-8" ?> - <result> <level>status</level> <code>NetConnection.Call.Success</code> <timestamp>8/25/2010 2:51:34 AM</timestamp> <name>_defaultRoot_:_defaultVHost_:::_1</name> - <data> <_0>20p5tc0bqm25an2</_0> <_1>42fem6h84kq3nmb</_1> <_2>b2zudqmrfqa05a6</_2> <_3>bsbzrnde1z4qmdv</_3> <_4>cgpm8wlvzyrp6b7</_4> <_5>hqy95ympgq1t5ui</_5> <_6>qa8ultkr5pv2vas</_6> <_7>qr94iqvdqag26ee</_7> <_8>wjesw80adgv4usu</_8> <_9>zcdua1yok7kw5l4</_9> </data> </result> I am not sure what is going wrong but I have not changed any of my codes and now I am getting this error message on a simple form that I am testing. Any idea what has happened. I have had several successful tries that have updated to the db. Quote Warning: mysql_query() [function.mysql-query]: Access denied for user 'ebermy5'@'localhost' (using password: NO) in /home/ebermy5/public_html/form.php on line 20 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/ebermy5/public_html/form.php on line 20 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/ebermy5/public_html/form.php on line 21 Warning: mysql_query() [function.mysql-query]: Access denied for user 'ebermy5'@'localhost' (using password: NO) in /home/ebermy5/public_html/form.php on line 29 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/ebermy5/public_html/form.php on line 29 This is the form Code: [Select] <?php @include_once ("Connections/connect_to_mysql.php") or die('could not connect to database'); $err=''; if($_POST["submit"]){ // Validate form data if($_POST["firstname"]=='') $err.='Please enter First Name<br>'; if($_POST["email"]=='') $err.='Please enter Email<br>'; if($err==''){ // Check if there are duplicate entries in the 'contacts' table $results = mysql_query("SELECT id FROM `Members` WHERE firstname='".addslashes($_POST["firstname"])."' and Email='".addslashes($_POST["email"])."'"); if($row = mysql_fetch_array($results)){ $err.='Can not add duplicate entry<br>'; } else{ // adding new record to 'contacts' table mysql_query("INSERT INTO Members (firstname,lastname,country,Email) values ('".addslashes($_POST["firstname"])."','".addslashes($_POST["lastname"])."','".addslashes($_POST["country"])."','".addslashes($_POST["email"])."')"); // redirecting to success screen exit; } } } ?>The HTML below.. Code: [Select] <html> <head> <title>Add New Contact</title> </head> <body> <h2>Register with us</h2> <?php echo $err==''?'':('<p style="color:red;">'.$err.'</p>') ?> <form method="post" action="form.php"> <table border="0"> <tr> <td valign="middle">First Name:</td> <td><input type="text" name="firstname" size="30" value="<?php echo htmlspecialchars($firstname) ?>"></td> </tr> <tr> <td valign="middle">Last Name:</td> <td><input type="text" name="lastname" size="30" value="<?php echo htmlspecialchars($lastname) ?>"></td> </tr> <tr> <td valign="middle">Country:</td> <td><input type="text" name="country" size="30" value="<?php echo htmlspecialchars($country) ?>"></td> </tr> <tr> <td valign="middle">Email:</td> <td><input type="text" name="email" size="30" value="<?php echo htmlspecialchars($email) ?>"></td> </tr> </table><br> <input type="submit" name="submit" value=" Submit! "> </form> </body> </html> Hey eveyone, I have this great idea I would love to do but I have some questions and whenever I have questions I come here and they always get answered :-) Anyway what do you guys know about SMS short codes (you know those commercials on TV that are like text ringtone1 to 555)? I did some quick reading and it seems they are super expensive?!? Is there anyway to get them free or cheaper if you can write your own code? Has anyone had any experience with sms short codes? Also is there anyway for a site to receive a SMS and then charge that persons service provider with php? Thanks This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=317279.0 Hello everyone, Can somebody help me? I am a novice in PHP programming. I do not understand a line of code below: $action = isset($_GET['action']) ? $_GET['action'] : ''; The variables $action saves the values obtained by the GET method, but what does this piece of code ? $_GET['action'] : ''; Thanks in advance! I am using a sloppy 3rd party API that doesn't return error codes, just error messages. See below Code: [Select] $err = $object->getErrorMessage(); if( strlen($err) > 0 ) { header("Location: step1.php?err=$err"); } As you can see this is sloppy because anyone can just modify the address bar of step1.php and inject their own error message, or javascript or their own HTML buttons, etc. As a work around, I thought maybe I could use POST instead of GET... At least then the "err" variable would be hidden for the most part Any ideas how I can work around this? Thanks! I'm trying to create a part of a script where by the system will generate a sku code and loop through out to see if this exists in the database, if the sku does the script adds one too the code so 001 will turn to 002 then it will keep looping until it finds a SKU that isn't in the database.
However I can get the script to keep generating the new SKU codes but it will only test the first SKU code so the loop will keep going if it exists.
$number=001; if(isset($_POST['submit'])){ $product = $_POST['product']; $brand = $_POST['brand']; $description = $_POST['description']; $contruct=strtoupper($product."-".$brand."-".$description); $number=sprintf("%03s",$number); $check_for=$contruct."-".$number; $query=$cc_db->query("SELECT `sku` FROM `product` WHERE `sku`='".$check_for."'"); $fetch=$cc_db->fetch_object($query); $checking=$cc_db->num_rows($query); while($checking > 0){ echo"$check_for is there : $checking rows : $fetch->sku<br>"; $number=$number+1; $number=sprintf("%03s",$number); $check_for=$contruct."-".$number; } echo $checking; echo $check_for; } This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=333293.0 I need to echo out a database value that contains an embed code for soundcloud (music hosting site), into a value of a text input. How do I do this without the object getting rendered? This is an example of an embed code. <object height="81" width="100%"> <param value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fgeneralpie%2Fdukebox001&secret_url=false" name="movie"> <param value="always" name="allowscriptaccess"> <embed height="81" width="100%" type="application/x-shockwave-flash" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fgeneralpie%2Fdukebox001&secret_url=false" allowscriptaccess="always"> </object> The value has to stay exactly the same so that it can pass a regular expression for validation. Is this possible? I have this part of the code: for($number_words_loop = 0; $number_words_loop < $number_words; $number_words_loop++) { $value1 .= 'AND a.adtitle RLIKE \'[[:<:]]' . $words[$number_words_loop] . '[[:>:]]\''; $value2 .= 'AND a.addesc RLIKE \'[[:<:]]' . $words[$number_words_loop] . '[[:>:]]\''; } And I want to combine $value1 and $value2, so the code should look something like this: for($number_words_loop = 0; $number_words_loop < $number_words; $number_words_loop++) { $value .= 'AND a.adtitle RLIKE \'[[:<:]]' . $words[$number_words_loop] . '[[:>:]]\' OR AND a.addesc RLIKE \'[[:<:]]' . $words[$number_words_loop] . '[[:>:]]\''; } In the first code, first it checks $value1 and then $value2 one by one, and that way it checks if both of them contain all the words that are put in the search field. What I need is to check if all the words that are put in the search field are contained in the one OR in the another. I want to make it search through both of them at the same time, but I don't know how to put correctly that OR I put in the second example. So any professional help will be appreciated. Here is an example of what I mean: If the Ad has this: Ad Title: nokia phone on sale Ad Description: brand new, unpacked, with 16gb memory card included. and if someone searches for nokia sale it will show the ad, because all the search words are contained in the Ad Title. Also, if the search is brand unpacked it will also show the ad, because all the search words are contained in the Ad Description. But, the problem is if someone searches for nokia brand This way, the word nokia is not contained in the Ad Description, and the word brand is not contained in the Ad Title, so the ad will not be shown. So, I only need a way to put that OR correctly to connect those two values, just like the second code, but in the right way. Thanks in advance. I am letting users select there color code option for text-shadow for there username I am storing them into a field called "color" HEX exaMPLE: FF6633,AA3633 First is the background color, 2nd is the foreground. (then i'll explode them) Is there a PHP function that let's me validate the input so it's HEX ONLY? I will be db escaping it and intval it too. Hi everyone,I want to learn PHP hook and I try hook examples.I tired this example but I saw only white page.It has a problem but I can't understand it Codes; hook.php <?php class Hooks { public function add($hook,$class=null,$method=null,$args=null) { if (empty($method)) error("You must include a method (function) when defining add_hook."); $this->hooks[$hook][]=array((!empty($class)?array($class,$method):$method),$args); return $this; } public function clear($hook=null) { if (!empty($hook)) unset($this->hooks[$hook]); else $this->hooks=null; } public function run($hook) { if (empty($this->hooks[$hook])) return $this; foreach ($this->hooks[$hook] as $hkey=>$hvalue) { if (is_array($hvalue[0])) $hvalue[0]=array($hvalue[0][0],$hvalue[0][1]); if (!empty($hvalue[1])) if (!is_array($hvalue[1])) call_user_func($hvalue[0],$hvalue[1]); else call_user_func_array($hvalue[0],$hvalue[1]); else call_user_func($hvalue[0]); } return $this; } } ?> script.php <?php // For a function: function doTitle() { echo $current->title; } $hooks->add('head_title',null,'doTitle'); // For a class: class Output { function body_final() { echo implode("\n",$this->body); } } $hooks->add('page_body','Output','body_final'); // To pass multiple arguments into a function, you must use: function test($arg1,$arg2) { echo "Arg1: {$arg1}, Arg2: {$arg2}"; } $hooks->add('page_body',null,'test',array('test','ing')); ?> index.php <?php // You must include the hook file here, or you can make an includes file to do all of your startup (as is normally done). include 'hook.php'; include 'script.php'; ?><!DOCTYPE html> <html> <head> <?php run('head_meta'); ?> <title><?php $hooks->run('head_title'); ?></title> <?php $hooks->run('head_links'); $hooks->run('head_scripts'); ?> </head> <body> <?php $hooks->run('page_body'); ?> </body> </html> Thank you Hello. i have created a template in dreamweaver, however when i added php code to a page the position of my bottom div got messed up... it works 100% with just text. I have a container div with other divs in it. inside the container div i have a div named content, and this div is the only div which is editable. in the bottom (outside of the container div) i have a bottom div which is centered with margin:0 auto; this divs position gets totally messed up once i add php code in the content div. http://elevweb.skit.no/0111nema/action_adventure.php here is the link to the page with php with it, as u can see the div with facebook etc in it got a messed up position. |