Jump to content

Trooper

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Everything posted by Trooper

  1. I've been using Zend Framework for my blog. I like it...its great how fast I can build it now.
  2. I can't figure out how to build an RSS feed using Zend_Feed. This is my code, but it gives me an error where the entries => $posts saying that posts is undefined. Also, FireFox just downloads it as if it were a file...its not viewing it as an rss feed. Possibly cause of this error. Any help would be great! /* RSS Action * This generates an RSS feed from the posts */ public function rssAction() { $db = Zend_Registry::get( 'db' ); $postresult = $db->fetchAll( 'SELECT * FROM posts WHERE post_published=1 ORDER BY post_date DESC' ); for( $i = 0; $i == count( $postresult ); $i++ ) { $posts[$i][] = array ( 'title' => $postresult[$i]['post_headline'], 'link' => 'http://192.168.0.25/index/post/id/' . $postresult[$i]['post_id'], 'description' => substr( $postresult[$i]['post_copy'], 0, 100 ), 'content' => $postresult[$i]['post_copy'], 'lastUpdate' => $postresult[$i]['post_date'] ); } $feeddata = array ( 'title' => 'Ryan\'s Blog', 'description' => 'My personal blog about what ever is on my mind...usually technology related.', 'link' => 'http://192.168.0.25', 'author' => 'Ryan', 'email' => 'trooper@spamex.com', 'charset' => 'UTF-8', 'copyright' => 'Copyright © 2008 Ryan Capote', 'entries' => $posts ); $feed = Zend_Feed::importArray( $feeddata, 'rss' ); $feed->saveXML(); $feed->send(); }
  3. Anyway, I'm setting up Smarty in my new blog app and for some reason, its not loading my style sheet. This is what is sent to the browser: <!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" lang="en" xml:lang="en"> <head> <title>Index :: Ryan</title> <link href="rcblog.css" rel="stylesheet" type="text/css" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <body> <p>Bork bork bork</p> </body> </html> Here is how it works: PHP script tells smarty to render the index.tpl index.tpl includes: header.tpl footer.tpl All in the same directory. In the header.tpl, is everything from the doctype to <body>. So either something is wrong with FireFox, my CSS, or something funky is wrong because of all these remote calls. Everything is in the same directory, aside from the php script. The template files are outside the viewable directory on the web server. My CSS body { background-color: #000; } p { color: #FFF; }
  4. Ohh...shouldn't it only loadTempalateFile if %templateheader% is in the file tho?
  5. Ok I have these functions inside a class called TemplateSystem: function loadTemplateFile( $filename ) { $file = file( $filename ); if( $file == false ) return null; $file = implode( " ", $file ); return $file; } function parseTemplateFile( $file ) { $file = str_replace( "%templateheader%", $this->loadTemplateFile( "style/header.html" ), $file ); $file = str_replace( "%templatefooter%", $this->loadTemplateFile( "style/footer.html" ), $file ); //$file = str_replace( "%iecheck%", tmplIECheck(), $file ); return $file; } function renderPage() { $page = $this->loadTemplateFile( "style/page.html" ); $page = $this->parseTemplateFile( $page ); $page = str_replace( "%templatecontent%", $this->contents, $page ); echo $page; } Now the way I have posted works exactly as expected. Now if I write the load function like this: function loadTemplateFile( $filename ) { $file = file( $filename ); if( $file == false ) return null; $file = implode( " ", $file ); return $this->parseTemplateFile( $file ); } ...and remove the parseTemplateFile from the renderPage function, nothing appears on the screen and the page is compleatly blank. All three functions are in the same class. I have no idea why this is. Thanks, Ryan
  6. Thanks, but it still doesn't work. Here is my php code: [code] <?php switch($_GET["action"]) { case "home": echo "<p>home</p>"; break; case "about": echo "<p>about</p>"; break; case "programs": echo "<p>programs</p>"; break; case "links": echo "<p>links</p>"; break; default: echo "<p>ERROR</p>"; break; } ?> [/code]
  7. Hello, I have this code, but for some reson it won't replace the content of <div id="content">. I am 100% sure its not the php code. The php code simply echos some html out as a filler. [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>My Site</title> <link rel="stylesheet" type="text/css" href="./style.css" /> <script type="text/javascript"> function createRequestObject() { var req; if(window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if(window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } else { alert('Your browser does not support AJAX. Get FireFox: http://www.firefox.com'); } return req; } var http = createRequestObject(); function sendRequest(action) { http.open('get', './pages.php?action='+action); http.onreadystatchange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4 && http.status == 200) { var response = http.responseText; if(response) { document.getElementById("content").innterHTML = response; } } } </script> </head> <body> <div class="head"><h1>rPod</h1></div> <div class="navigation"> <a class="tab" href="javascript:sendRequest('home');">Home</a><a class="tab" href="javascript:sendRequest('about');">About</a><a class="tab" href="javascript:sendRequest('programs');">Programs</a><a class="tab" href="javascript:sendRequest('links');">Links</a> </div> <div id="content" class="content"> <p>BORK DORK CORK</p> </div> <div class="infopix"> <img src="./graphics/tableless.gif" alt="Tableless" /> <img src="./graphics/css.png" alt="W3 CSS valid" /> <img src="./graphics/html.png" alt="XHTML 1.0 valid" /> <img src="./graphics/php-power.png" alt="PHP Powered" /> <img src="./graphics/mysql.gif" alt="MySQL Powered" /> <img src="./graphics/firefox.png" alt="Best viewed in Firefox" /></div> <p class="copyright">Copyright &copy; 2006-2007 Ryan Capote</p> </body> </html>[/code]
  8. Hello all, I am having problems with my website. http://www.christiangaming.org/graphics/users/stormtrooper Basically everything looks fine in FireFox but not IE. my CSS: http://christiangaming.org/graphics/users/stormtrooper/stylesheet.css
  9. What is the best way to do a system where it uploads the last time you visited a page using PHP and MySQL? I need this so I know to change a image if there was a new update since the user last visited, like what happens on the forums.
  10. I'm writing a mod for Phpbb which allows users of a specific rank acess a page and upload files. Is there a way to stop someone from finding out whats in the directory the files are uploaded in, and stop them from being able to access the file unless they are given the specific URL? Thanks
  11. Well, I have phpmyadmin. I guess I could do that.
  12. so no ones gonna help me eh? I feel, lonly.
  13. Okay I have this code that checks to see if a table exists... [php:1:4304a899c6]<?php if(mysql_list_tables($dbname) != news){ CREATE TABLE news ( //<-- This is were the error is author VARCHAR(30) NOT NUUL, dateposted DATETIME NOT NULL, title VARCHAR(100) NOT NULL, content CHAR(99999) NOT NULL, ) } ?>[/php:1:4304a899c6] but when i go to the page i get this error... ?>[/code]
×
×
  • 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.