Jump to content

ShoeLace1291

Members
  • Posts

    401
  • Joined

  • Last visited

Everything posted by ShoeLace1291

  1. I am using CodeIgniter to develop my website, so I downloaded a Google Map API class for it. I think I have everything set up correctly, however, I still get a blank map... just a square, grey box. I have no idea what is causing this. It won't work in both firefox and IE. Here is my controller: <?php class Maps extends CI_Controller { function index(){ $this->load->library('GMap'); $this->gmap->GoogleMapAPI(); $extraJS = ' '.$this->gmap->getHeaderJS().' '.$this->gmap->getMapJS().' '; $this->_global->overall_header('Outbreak Map', $extraJS); $this->gmap->setMapType('map'); $this->gmap->setWidth('800px'); $this->gmap->setHeight('600px'); $data = array( 'MAP_onload' => $this->gmap->printonload(), 'MAP_DISPLAY' => $this->gmap->printMap(), 'MAP_SIDEBAR' => $this->gmap->printSidebar() ); $this->parser->parse('map_index.tpl', $data); } } The header view: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>MySitek</title> <link rel="stylesheet" href="{CSS_DIR}/style.css"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript" src="{JS_DIR}/jkoutlinemenu.js"></script> {EXTRA_JS} </head> <body> The map_index.tpl file: {MAP_onload} <div id="content"> <div class="widget full"> <div class="pad"> {MAP_DISPLAY} {MAP_SIDEBAR} </div> </div> </div> The class I am using can be found here: http://codeigniter.c...wthread/164367/ This is getting really frustrating because I can't figure out what the problem is and I know it will be something smple causing it... Any help is appreciated!
  2. I need to write a function that calls another functions, but it needs to pass arguements to the new function with an array... Here's an example: echo fruit('colors', array('banana' => 'yellow', 'apple' => 'red', 'pear' => 'green'); Would basically translate to echo fruit($method = 'colors', $banana = 'yellow', $apple = 'red', $pear' = 'green'); I need to do this because the arguements for the functions that are being called are usually different. Any suggestions?
  3. So, I am using SMF and I want to use the SSI features within my regular site. However, I want to do this within a class that I am creating. I want to include the file at the top of the page so that I can use the $context array that contains all of the information I need in every method I create... without having to include the file within every new method. Here's what I have so far: <?php include('/../../forums/SSI.php'); class smf { var $username; var $is_guest; var $is_logged; var $is_admin; var $is_mod; var $email; var $name; var $avatar; function __construct(){ $this->username = $context['user']['name']; $this->is_guest = $context['user']['is_guest']; $this->is_logged = $context['user']['is_logged']; $this->is_admin = $context['user']['is_admin']; $this->is_mod = $context['user']['is_mod']; $this->email = $context['user']['email']; $this->avatar = $context['user']['avatar']; } function context(){ return $context; } } I get an undefined variable method every time I call the context variable.
  4. In the past, when I develop a website it usually consists of a members database and login system. Currently, I am in the process of creating my own personal website. I am going to develop an admin area for myself to easily manage the content, but I will be the only person using it. Instead of making a members table in the database, I thought I would just store the admin login information in a config file, and then validate the login information based on that. A though came across my mind, however, that it might be unsecure to do this... can anybody think of any reason as to why doing this would be unsecure?
  5. So, I've been developing websites with PHP as an amateur for about 5 years now, and decided that I want to do so as a career. College really isn't for me... I've tried it a couple of times and flunked out. My friend who is in Iraq as an IT help desk administrator for an army base suggested that I get a PHP certification from Zend and then a Zend Framework certification. I was wondering... how much would getting this certification actually help me? He said that PHP/MySQL programmers make $300k/year over there with those credentials, but I find that hard to believe... although, he said he makes around $200k/year doing his IT thing without any college education. Would it be worth it to get Zend certifications? Are there other PHP certifications out there that are more credible?
  6. Does anyone know of any "beta signup scripts"? I need a free script that allows users to sign up for my website's beta testing. I'm looking for something that has a sign up form(secure) and an application management area. Anyone have any ideas?
  7. I am trying to convert a number of the month to the name of the month... For example: 12 would convert to December. What's the best way to do this?
  8. Are there any CAPTCHA services besides reCaptcha? I don't like the reCaptcha service very much... actually, it's not a bad service at all, it's just too damned hard to read the words sometimes... their fonts are terrible and the letters are so close together that it's impossible to read them. Anyone have any experiences with other CAPTCHA services?
  9. So I'm trying to make an MVC framework from scratch and need a way to route my uri segments... what I need to do is determine what controllers and methods need to be set based on the given URI. For example, a uri of forums/xbox-360/1 would be directed to the forums controller and the view forum method. What would be the most efficient way to go through all of the uri segments to determine if they should be set to controller directories, controllers, or methods?
  10. I thought that's what $this->load->model('member") does... right?
  11. Oh, sorry, forgot to include this one... members.php model <?php class Member { function info(){ return array( 'first' => 'Hello, ', 'last' => 'World!' ); } } And it is called in the Test controller.
  12. So I'm in the process of coding a VERY light MVC framework... only have run into one problem thus far. I can't seem to get my models to load. Undefined property: Test::$member in W:\wamp\www\basecmd\controllers\test.php on line 8 This is controllers/test.php <?php class Test extends Controller { function index(){ $this->load->model('member'); $data = $this->member->info(); $this->load->view('test_view'); } } This is the controller class: <?php class Controller { public $load; public $model; function __construct(){ $this->load = new Load; } } This is the load class: <?php class Load { function view($filename = '', $data){ if(is_array($data)){ extract($data); } if(file_exists(APP_PATH.'/views/'.$filename.'.php')){ include(APP_PATH.'/views/'.$filename.'.php'); } else { die('Requested view could not be loaded: '.$filename); } } function model($filename){ if(file_exists(APP_PATH.'/models/'.$filename.'.php')){ include(APP_PATH.'/models/'.$filename.'.php'); $this->$filename = new $filename; } else { die('Requested model could not be loaded: '.$filename); } } function controller($classname){ if(file_exists(APP_PATH.'/controllers/'.$classname.'.php')){ include(APP_PATH.'/controllers/'.$classname.'.php'); $$classname = new $classname; } else { die('Requested controller could not be loaded: '.$classname); } } function system_class($classname){ if(file_exists(APP_PATH.'/system/'.$classname.'.php')){ include(APP_PATH.'/system/'.$classname.'.php'); $this->$classname = new $classname; } else { die('Requested system class could not be loaded: '.$classname); } } } And finally, my front controller(index.php) <?php define('APP_PATH', dirname(__FILE__)); define('APP_SUBDIRECTORY', '/basecmd'); require_once(APP_PATH.'/system/load.php'); $load = new Load; require_once(APP_PATH.'/system/controller.php'); require_once(APP_PATH.'/controllers/test.php'); $test = new Test; $test->index(); ?> Note: My front controller is just a test for now. I still have to come up with a way to route the URL's to the correct class/method. Any help is appreciated! Thanks for your time.
  13. Thank you, thorpe, for making such an informative post. I've been snooping around google for a good URI Routing class, but none really seem to do what I want. I'll just have to study some of your framework as an example and hope that I can come even close to compiling a code that's as versatile.
  14. Are you sure that there is more than one row being selected?
  15. Try this: if(!mysql_query($sql, $con){ die("Error: ".mysql_error(); } else { echo "<b><font color='white' face='segoe' size='2'>1 record added</b></font>"; include "/submit/redirect_churn.html"; }
  16. Here are several requests of mine... I think more people would find these tutorials to be useful. 1: Pretty URL's with URL Routing (Object Oriented) 2: Tag Clouds and Querying Similar Posts (Comma-Separated Values) 3: How to Write a Lightweight MVC I know there are a lot of these tutorials on the net, but the ones I've found either aren't formatted well, or are very hard to follow. I really prefer PHPFreaks tutorials over most other websites' tutorials. Just a few suggestions!
  17. So, I am beginning the process of coding a PHP application website, which will be coded in the MVC architecture,but would like to implement the method of using Pretty URL's with it. Since I have never created my own Pretty URL code before, I'm not sure where to start. In the past, I would use query string URL's(I think that's the correct term to use) such as example.com/index.php?act=controller&sub=method&id=123456... With this website, I would prefer the URL's to be something more like example.com/controller/method/article-title/123456. But, like I said, I'm not even sure of where to start. How would I point the URL correctly if... The method provided isn't found, is invalid, or not provided at all? example.com/controller/article-title/123456 (would point to example.com/provided-controller/default-method/page-title/123456 The method provided is found, is valid, and is provided, but no controller is found or is invalid or is not provided? example.com/article-title/123456 (should point to example.com/default-controller/provided-method/123456) I hope I am being clear on everything and that you get what I'm talking about. Basically, I want to do something like the CodeIgniter URL Router system. Thanks for your time!
  18. Oh, haha forgot about that one... thanks for the help, though!
  19. Now it's returning this error: Here's the updated code: $bb_search = array( '#\[b\](.*?)\[\/b\]#', '#\[i\](.*?)\[\/i\]#', '#\[u\](.*?)\[\/u\]#', '#\[ul\](.*?)\[\/ul\]#', '#\[ol\](.*?)\[\/ol\]#', '#\[li\](.*?)\[\/li\]#', '#\[sub\](.*?)\[\/sub\]#', '#\[sup\](.*?)\[\/sup\]#', '#\[img](.*?)\[\/img\]#', '#\[url=(.*?)\](*?)\[\/url\]#' ); $bb_replace = array( '<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<ul>$1</ul>', '<ol>$1</ol>', '<li>$1</li>', '<sub>$1</sub>', '<sup>$1</sup>', '<img src=\'$1\' alt=\'Image Not Available\'>', '<a href=\'$1\' title=\'$2\'>$2</a>' ); $str = preg_replace($bb_search, $bb_replace, $str);
  20. I just wrote a BBCode script for my application, but I have no idea why it's returning this error: Line 250 is the line that the preg_replace function is called on. This is the code: $bb_search = array( '\[b\](*?)\[\/b\]', '\[i\](*?)\[\/i\]', '\[u\](*?)\[\/u\]', '\[ul\](*?)\[\/ul\]', '\[ol\](*?)\[\/ol\]', '\[li\](*?)\[\/li\]', '\[sub\](*?)\[\/sub\]', '\[sup\](*?)\[\/sup\]', '\[img]http://(*?)\[\/img\]', '\[url=(*?)\](*?)\[\/url\]' ); $bb_replace = array( '<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<ul>$1</ul>', '<ol>$1</ol>', '<li>$1</li>', '<sub>$1</sub>', '<sup>$1</sup>', '<img src=\'$1\' alt=\'Image Not Available\'>', '<a href=\'$1\' title=\'\\2\'>\\2</a>' ); $str = preg_replace($bb_search, $bb_replace, $str);
  21. I'm looking for a piece of computer software that will provide FTP access, a SQL manager(PHPMyAdmin, etc), and a code editor all in the same window... would probably be split up into tabs or something, but I was wondering... does something like this exist?
  22. Visual QuickStart Guide: JavaScript & Ajax by Tom Negrino and Dori Smith is pretty good. My college photoshop class used a PS book from the Visual QuickStart series
×
×
  • 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.