PHP - I Made A New Template For Site. Is Site Better?
Hi I made a new design for my website and I made some changes. I want to use layout for my second site.
I'll like to know if my site is easier to browse through now and if you like the design better?. I test my site on internet explorer, chrome, and firefox. It is best to use site on better browsers like firefox and chrome to get a better experience of site. Thanks.
http://adjade.com
Similar Tutorialshi, when I made my website I thought it would be a good idea to put the information I'm outputting in a function so I could just call that function on a single template page. However, everytime I load a page on the server it loads all the static content first (ie, sidebar, logo, ect.) Then it loads the dynamic content. I'm okay with this, but it also doesn't add in the background until after it loads the dynamic content (which bothers me). Can I re-arrange my site's coding to prevent this? Thanks - charlie PS: my site is www.rushhunt.com I have several "sites" located in my html directory, and each has a "general" access point and an "administrator" access point:
/var/www/html/site1/index.php /var/www/html/site1/administrator/index.php /var/www/html/site2/index.php /var/www/html/site2/administrator/index.php /var/www/html/site3/index.php /var/www/html/site3/administrator/index.phpAll sites are similar except that data will be specific to site1, site2, or site3, etc. Users who log onto /var/www/html/siteX/index.php are totally unrelated to those who logon to /var/www/html/siteX/administrator/index.php, will have different logon credentials, are stored in different DB tables, and each should have their own session. If a user logs off of either the general or administrator site, it should not effect the other site even if they were previously logged on to both on the same PC (and of course not effect other sites). When a user logs off, I would like to destroy their previous cookie and associated session. Users for either will only use https. I am using Apache to rewrite https://www.mysite.com/ to https://mysite.com/. While I named the administrator site "administrator" above, the administrator user has the ability to change the directory name. I am thinking I need to use session_set_cookie_params to specify where I wish the session cookie to be stored since /var/www/html/siteX/administrator/index.php is a sub-directory to /var/www/html/siteX/index.php, but am not really sure. Sorry for the cryptic post, but I am not very well versed in this subject. How would you recommend setting up cookies/sessions for this scenario? Thank you Hi, My first post here is a cry for help I have a Windows 2003 server running IIS6/PHP5, the server hosts multiple web sites. The problem is include files that are for site A are showing on site B (each site having its own includes as part of the site files in its own site folder), though not every time, its very random, sometimes the correct includes show, sometimes ones from another site on the same server. This only occurs where the include files for both sites have the same name, such as 'inc-header.php' for example. I can only assume PHP is caching includes and because they have the same name is showing the wrong one on other sites sometimes, if I rename them to something unique then the problem goes away, but its not a practical solution to rename all include files to unique names so I find myself looking for a 'real' fix. I have a feeling its to do with the include_path in the php.ini, but right now its disabled with a semi-colon, and I don't want to set one as I have no global includes, all includes are site specific. Any help would be very much appreciated! Phil Not sure if I'm trying to achieve something totally crazy here, or if this is something pretty standard. Didn't have much luck with searching as I'm not fully down with all the terms. (A) I have one site providing an RSS feed. (B) I have one site I want to search, once for each of the items in the feed A. (C) I want the results of the search in (B) to be displayed on page (C). So for example, the feed on (A) says; apples bananas oranges cheese I want site (B) to search for each of those terms (by passing the item in the feed (A) to the ?search= part of the URL of that page) and then show the results from THAT search on page C. Bit of a complex one, let me know if you need me to clarify. Thanks for any help! now i use this code to show where the visitors came from to my site. <?php $referer=$_SERVER['HTTP_REFERER']; echo $referer; ?> now, i want to show the 5 latest vistors referer's site url on my site ? So I made a template class, it's very simple, pretty much allows the usage like so: $template = new template("blogpost"); $template->fillBraces(array( "TITLE" => "How to bathe your chimpanzee", "AUTHOR" => "Jim Bo James" )); $template->render(); Simple, uses tpl files, similar to what phpbb used a long time back, not sure if they still do. My main goal for this is to have a file that has something like this: {HEADER} {MAIN_CONTENT} {FOOTER} and the above usage to stay the same, however that would fill the main_content part, and the header and footer would be grabbed from header/footer tpl files. Any idea on suggestions? The full class is posted below. class template { protected $_viewContents; function __construct($viewName) { $this->_viewContents = file_get_contents(TEMPLATE.$viewName.TEMPLATE_EXT); return; } function sourceOf($fileName) { return @file_get_contents(TEMPLATE.$fileName.TEMPLATE_EXT); } function fillLayout() { } function fillBraces($information, $replacement=NULL) { if (is_array($information)) { foreach ($information as $key => $val) { $this->_viewContents = str_ireplace("{".$key."}", $val, $this->_viewContents); } return; } elseif ($replacement!=NULL) { $this->_viewContents = str_ireplace("{".$information."}", $replacement, $this->_viewContents); return; } } function render() { echo $this->_viewContents; } } Thanks! Transferring data from sub-domain.site.com Reading sub-domain.site.com What is this all about? I'm going to put all .. images into a separate sub-domain eg: images.site.com. This would create a folder inside my public_HTML called "images" Now when sites have that Transferring data, and Reading... is this .. something relating to what I want. Facebook also does it, and they get their images for the site from a sub domain, how is it all done? I'm not sure if its entirely PHP, but I hope someone can help. Thanks I'm currently running a classified ads site and planning to display my own content from database combined with and external site rss. So here is what i got right now after the db query for the jobs ads (procedural php),
while ($row = mysqli_fetch_array($results, MYSQLI_ASSOC)){ echo '<div class="media margin-none"> <a class="pull-left bg-inverse innerAll text-center" href="#"><img src="'.$foto.'" share_alt="" width="100" height="100"></a> <div class="media-body innerAll"> <h4 class="media-heading innerT"> <a href="' . $row['title'] .'-da' . $row['id_ad'] . '" class="text-inverse">'. $remuneracion .' ' . substr(ucfirst(strtolower($row['title'])), 0, 53) . '</a> <small class="pull-right label label-default"><i class="fa fa-fw fa-calendar-o"></i> ' . $row['date_created'] . '</small></h4> <p>' . substr(ucfirst(strtolower($row['description'])), 0, 80) . ' ...</p>'; echo '</div> </div> <div class="col-separator-h"></div>'; } echo pagination($statement,$per_page,$page, $url_filtros, $filtros); ?>it is the while loop that i use to display ads from my database, what could be the best way to display (in this same loop?) other site's rss feed so i can show my content combined with the external rss? Thanks This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=318858.0 How do I only redirect the page when index.php is present? How can i make echo "<b>Site:</b> ".$req_user_info['site']."<br>"; linkable The site raw fron the db contains an site url. Regards hi, i am developing a toplist site, i have it fully working but... people can register multiple times with the same title, and password not so concerned about password but i dont want 50 of the same titled websites no it here is my code for inserting the data to the mysql database Code: [Select] <?php include("config.php"); $sql="INSERT INTO sites (title, content, link, password) VALUES ('$_POST[title]','$_POST[content]','$_POST[link]','$_POST[password]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Site has been registered. Please check the homepage."; mysql_close($con) ?> and here is the register form code (i dont think you need it though) Code: [Select] <form action="insert.php" method="post"> <table align="center" border="0" bordercolor="" style="background-color:" width="400" cellpadding="3" cellspacing="3"> <tr> <td>Site name:</td> <td><input type="text" name="title" /></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="password" /></td> </tr> <tr> <td>Link to site:</td> <td><input type="text" name="link" /></td> </tr> <tr> <td>Description:</td> <td><textarea name="content" ></textarea></td> </tr> <input type="submit" value="Register" ></input> </table> </form> Hi there i was wondering is anyone could help me in creating a page for each site like info.php?site=sitename I've Currently got this but its not really working... Code: [Select] <?php include ("config.php"); $ServerName = $_GET['title']; $server = "SELECT * FROM sites WHERE title='$ServerName'"; $desc = $_GET['content']; $content = "SELECT * FROM sites WHERE content='$desc'"; $url = $_GET['link']; $link = "SELECT * FROM sites WHERE link='$url'"; if ($info== "$server") { echo "<h1>$server</h1>"; echo "<p>$content</p>"; echo "<a href='$link'>Visit Site</a> OR <a href='play.php?server=$server'>Play Now</a>"; } ?>Please relpy ASAP & Thank You in Advance... some guy went on my site and was able to get all the cookies of every user on my site. Its the top thread, he said my site is full of xss, im not sure what that means or how to protect against it the site is www.imgboard.co.uk can you give me some idea of what i done wrong etc I wasn't sure where to post this, but I thought this would be best as there are most people. I need a script to type in the url from a website and get the favicon as an image. Like if I type in http://www.facebook.com/ I get the facebook favicon displayed as an image. Any ideas how this would be done? im trying to make this kind of a page from this xml link from tvrage. can anyone help? i am newbie and sorry for bad english. xml link Code: [Select] http://services.tvrage.com/feeds/fullschedule.php?country=US this is coding for countdown all tv shows. so this may help to make my thing Code: [Select] <?php // Open Header, include functions and get the showid and cached xml include 'functions.php'; loadheader(); $loc = $_GET['loc']; $cache_time = 3600*24; // 24 hours $cache_file = './cache/countdown.xml'; $timedif = @(time() - filemtime($cache_file)); if (file_exists($cache_file) && $timedif < $cache_time) { $string = file_get_contents($cache_file); } else { $string = file_get_contents('http://services.tvrage.com/feeds/countdown.php'); if (($string) && ($f = @fopen($cache_file, 'w'))) { fwrite ($f, $string, strlen($string)); fclose($f); } } // Cached the file, now lets use it. if (!file_exists($cache_file)) { // Does it exist? If it doesn't there's a problem so lets report it. echo "<center><h2>Cache file issue: Cannot open cached XML poss connection issue?</h2></center>"; break; } $xml = simplexml_load_file($cache_file); echo "<div class=\"showtitle\">Current Countdown List for ".$loc."</div>\n"; echo "<table border=0 width=600px; cellpadding=2>\n"; echo "<tr><th width=30px;>Show:</th><th width=70px;>Episode:</th><th width=80px;>Season<br>Ep#</th><th width=80px;>Air Date</th><th>Relative Time: (From Cache File Creation)</th></tr>\n"; echo "<tr></tr>\n"; foreach($xml->country as $country){ echo "<tr><th colspan=\"5\"><b>Country List of: ".$country['name']."</b></th></tr>\n"; foreach($country->show as $node){ echo "<tr><td><a href=eplist.php?sid=".$node->showid.">".$node->showname."</a></td>\n"; echo "<td><a href=\"".$node->upcomingep->link."\">".make_safe($node->upcomingep->title)."</a></td>\n"; echo "<td>".$node->upcomingep->epnum."</td>\n"; echo "<td>".$node->upcomingep->airdate."</td>\n"; echo "<td>".$node->upcomingep->relativedate."</td></tr>\n"; } }echo "</table>\n"; echo "<p><div align=center>Page generated using a cached feed generated on: ".date ("F d Y H:i:s.", filemtime($cache_file))."</div></p>\n"; loadfooter(); ?> i got that script from here Code: [Select] http://sourceforge.net/projects/tvrageshellsite/ hello. i wonder if anyone could help me to solve this puzzle. im trying to create a dynamic navigation using a database but i keep getting stuck. i have 2 database: Navigation with : Quote id navPos pageID level parent url 1 top 1 1 0 page1.php 2 top 2 2 1 page2.php 3 top 3 3 2 page3.php 4 top 4 3 3 page4.php 5 top 5 3 4 page5.php 6 top 6 3 5 page6.php and Pages with: Quote id pageName 1 page1 2 page2 3 page3 4 page4 5 page5 6 page6 now, what i want to happen is on each page i have 3 functions. 1 calling the top nav, 1 calling the side nav and 1 calling the bottom nav. for this each function should have 3 levels. level 1 = main top level level 2 = child to main top level level 3 = child to level 2 so for example. 2 tabs each with 3 levels and 1 page on each level. TOP NAV Quote levels - TAB 1 - TAB 2 LEVEL1 - page1 - page4 LEVEL2 - page2 - page5 LEVEL3 - page3- page6 now for the code. I'LL STICK TO JUST THE TOP NAV FOR NOW. on the page that will display the navigation's i have: I WOULD LIKE THEM TO DROP DOWN BUT THIS CODE WILL NOT DO THAT. just lists for now Code: [Select] <div id="navWrapper"> <?PHP $navPosion = "top"; ?> <div id="LEVEL1" class="LEVEL1"> <ul><?PHP echo Navigation::NavL1($pageID, $navPosion); ?></ul> </div> <div id="LEVEL2" class="LEVEL2"> <ul><?PHP echo Navigation::NavL2($pageID, $navPosion); ?></ul> </div> <div id="LEVEL3" class="LEVEL3"> <ul><?PHP echo Navigation::NavL3($pageID, $navPosion); ?></ul> </div> </div> these is the functions im trying to put together. in the Navigation class i have. Code: [Select] class Navigation extends Pages{-----lots of other code here.... public static function navL1($pageID, $navPosion){ //FIND CURRENT PAGE ID $page = new Pages(); //calling just the Pages class. $CP = $page->find_by_pageID($pageID); $CPid = $CP->id; //GET ALL PAGES FROM THE DB $allP = $page->find_all(); foreach ($allP as $allPs){ $allPname = $allPs->pageName; //GET INFO FROMTHE NAVIGATION TABLE $nav2 = new Navigation(); //calling the navigation extension $Cnav = $nav2->find_all(); foreach ($Cnav as $Cnavs){ $Nid = $Cnavs->id; $Npos = $Cnavs->navPos; $Npid = $Cnavs->pageID; $Nlevel = $Cnavs->level; $Npnt = $Cnavs->parent; $Nurl = $Cnavs->url; $Nord = $Cnavs->order; if($Nlevel = '1'){ //FIND ACTIVE TAB if($CPid == $allPid){ $selected_tab='class="selected"'; }else{ $selected_tab=''; } echo '<li><a '.$selected_tab.' href="'.$allPname.'.php">'.$Nlevel.''.$allPname.'</a></li>'; }// if($Nlevel == $navLevel //} //end Navigation() }//end foreach ($allP as $allPs) } //end getNav($pageID) THEN THE SAME AGAIN FOR : public static function navL2($pageID, $navPosion){ and public static function navL3($pageID, $navPosion){ what this does is list all the pages for example navL1 give me Quote page1 page2 page3 page4 page5 page6 i want it to only list where level is 1 or 2 or 3 in each of the functions i have this but it does not seem to work. Code: [Select] if($Nlevel = "1"){ i tried this but i nothing return. Code: [Select] if($Nlevel == "1"){ if i echo this out in navL1 Code: [Select] echo "<br/>".$Nid = $Cnavs->id; echo "<br/>".$Npos = $Cnavs->navPos; echo "<br/>".$Npid = $Cnavs->pageID; echo "<br/>".$Nlevel = $Cnavs->level; echo "<br/>".$Npnt = $Cnavs->parent; echo "<br/>".$Nurl = $Cnavs->url; it gives me back the last page (page6) 6 time over which is not even level1. its level3 Quote 6 top 6 3 5 page6.php so its missing the rest of the pages in the loop and just out putting the last one. i realise that i need more if's in my function but maybe there is a better way ? for example i need an if($Npos == top) and in navL2 and navL3 i need to only show sub tabs under the correct parent. etc... for now i just want to get what i can working .. any thoughts ???? maybe i can roll all 3 functions into 1 amazing function ???? that would be nice. thanks ricky this is my first post (besides introduction and a comment in introduction) so im not 100% sure what all i am suppose to post for you guys so i will give it my best shot.. i have read 90% of rules though so i know what NOT to post lol here it goes: i am trying to get new messages to appear on header of my site but the alert (number) is not showing up.. this is in the <head> Code: [Select] <? include('inc.settings.php'); include('inc.networth.php'); @mysql_connect($dbhost, $dbuser, $dbpass); @mysql_select_db($dbname) or die("Error opening database"); $sqld = "SELECT * from og_userinfo where id=$userid"; $resultd = @mysql_query($sqld); $myrowd = @mysql_fetch_array($resultd); $networthck = $myrowd[networth]; $sqlornk = "SELECT count(*) from og_userinfo where networth > $networthck"; $resultornk = @mysql_query($sqlornk); $myrowornk = @mysql_fetch_array($resultornk); $orank = $myrowornk[0] + 1; $netstate = $myrowd[state]; $sqlornk2 = "SELECT count(*) from og_userinfo where networth > $networthck AND state=$netstate"; $resultornk2 = @mysql_query($sqlornk2); $myrowornk2 = @mysql_fetch_array($resultornk2); $orank2 = $myrowornk2[0] + 1; $pc_rank = $orank2 - 1; $pchk_rank = floor($pc_rank / 20); $plimit = $pchk_rank * 20; ?> --this is in the body-- Code: [Select] <table id="center" width="393" height="104" align="center" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="5"> <img src="images/center_01.gif" width="393" height="13" alt=""></td> </tr> <tr> <td rowspan="6"> <img src="images/center_02.gif" width="10" height="91" alt=""></td> <td width="372" height="28" colspan="3" align="center" bgcolor="#000000" alt="round time">round ends in: <? echo $dleft?> days, <? echo $hleft?> hours, <? echo $mleft?> minutes, <? echo $sleft?> seconds</td> <td rowspan="6"> <img src="images/center_04.gif" width="11" height="91" alt=""></td> </tr> <tr> <td colspan="3"> <img src="images/center_05.gif" width="372" height="8" alt=""></td> </tr> <tr> <td width="152" height="23" align="center" bgcolor="#000000" alt="messages"><a href="messages.php?uid=<? echo $uid ?>&secid=<? echo $secid ?>&type=1">messages</a> (<? echo $mmyrow[0] ; ?>)</td> <td rowspan="3"> <img src="images/center_07.gif" width="68" height="49" alt=""></td> <td width="152" height="23" align="center" bgcolor="#000000" alt="cartel messages"><a href="view.cartel.messages.php?uid=<? echo $uid ?>&secid=<? echo $secid ?>&type=1">cartel messages</a> (x)</td> </tr> <tr> <td> <img src="images/center_09.gif" width="152" height="4" alt=""></td> <td> <img src="images/center_10.gif" width="152" height="4" alt=""></td> </tr> <tr> <td width="152" height="22" align="center" bgcolor="#000000" alt="message board"><a href="cafe.messages.php?uid=<? echo $uid ?>&secid=<? echo $secid ?>&type=1">message board</a></td> <td width="152" height="22" align="center" bgcolor="#000000" alt="attacks"><a href="messages.php?uid=<? echo $uid ?>&secid=<? echo $secid ?>&type=2">attacks</a> (<? echo $mmyrow1[0] ; ?>)</td> </tr> <tr> <td colspan="3"> <img src="images/center_13.gif" width="372" height="6" alt=""></td> </tr> </table> i would really like the new messages to be in javascript so they show in real time instead of refreshing page but i know even less about that and all i can find info on on google is popup alerts which i dont want this is an image of the look im going for: I am inheriting a significant web site and have not played with PHP in quite a while. Is there a utility tool or something else that will take an initial starting web page and somehow map out all the included/required_once type of files so that I can quickly get an overview of the site? Mapping hyperlinks would also be very helpful. Any other tools/utilities/suggestions for reviewing the site would also be appreciated. i am a newbie.. From my tables, what code should i put to put into my site? in text.. |