The Little Guy
Members-
Posts
6,675 -
Joined
-
Last visited
Everything posted by The Little Guy
-
I am trying to think of the best way to store database login information (user, pass, host, database) that can be edited/updated in a form, and still not be view able in a browser without the use of htaccess, and still resided in a sub directory of the root. I was thinking of just writing the php code to a file whenever the form is submitted, but that doesn't seem logical. Any suggestions?
-
PrintMojo Doesn't sell that kinda stuff so your outta luck
-
So are you saying I am on the right track?
-
Well mine is only small right now, I just started it 2 days ago The plan is for it to become a full blown plugin based CMS.
-
+1 -- there's no benefit in using namespaces the way you are doing. Which part am I doing wrong?
-
Why thank you kicken for the tip, and thanks xyph for the clarification! It now works!
-
Okay I am starting to feel really stupid, but I feel like I am doing exactly that, and yet I am still having the same problem. Here are my EXACT files (except for the template one that is too long too post). /includes/setup.php <?php require_once __DIR__."/settings.php"; function __autoload($class){ if(is_file(__DIR__."/../classes/$class.php")){ require_once __DIR__."/../classes/$class.php"; } } use Cleep\Classes\Cleep, Cleep\Classes\Template, Cleep\Classes\Hook; $cleep = new Cleep(); $library = $cleep->activeTemplate(); $plugins = $cleep->getActivePlugins(); $template = new Template($library); $hook = new Hook(); /index.php <?php /** * @var $temp Template * @var $plugins ArrayObject */ require_once "includes/setup.php"; $template->metaTags(array( "description" => "This is a test", "keywords" => "one,two,three" )); $hook->triggerHook("index.content"); $template->display("index.tpl"); /classes/Cleep.php <?php namespace Cleep\Classes; use Cleep\Classes\Template; class Cleep extends Template{ public function __construct(){ parent::__construct(); } public function activeTemplate(){ return $this->db->getOne("select directory from templates where is_active = 1"); } public function getActivePlugins(){ $plugins = array(); $this->db->query("select * from plugins where is_active = 1"); while($row = $this->db->row()){ $plugins[] = $row; } return $plugins; } } /classes/Template.php <?php namespace Cleep\Classes; use Cleep\Classes\Base; class Template extends Base{ //The rest of the file...
-
Okay, so I removed the class name from the calls, so it now looks like this: namespace Cleep\Classes; use Cleep\Classes; class Cleep extends Template{ // And: namespace Cleep\Classes; use Cleep\Classes; class Template extends Base{ And I am still getting the same error.
-
But I am including the file... <?php function __autoload($class){ if(is_file(__DIR__."/../classes/$class.php")){ require_once __DIR__."/../classes/$class.php"; } } $cleep = new Cleep();
-
Am I doing this correctly? I am just learning on how to use namespaces in php, as I have never used them before. Cleep.php <?php namespace Cleep\Classes\Cleep; use Cleep\Classes\Template; class Cleep extends Template{ Template.php <?php namespace Cleep\Classes\Template; use Cleep\Classes\Base; class Template extends Base{ When I run it, I get the following error: Fatal error: Class 'Cleep\Classes\Template' not found in /home/ryannaddy/cms.cleep.us/classes/Cleep.php on line 4 I have a setup.php file which has __autoload() in it, and index.php includes it. Once I put the namesame and the use in, I got the above error.
-
So I kinda changed it up, taking some of your guy ideas (Thanks for the thoughts/help). What do you think of me taking this approach. <?php /** * @var $hook Hook * @var $template Template */ $blog = new stdClass(); $blog->hi = function($name) use ($template){ $template->assign("CONTENT", "Hi $name, I am a blog!"); }; $hook->register("blog", $blog); // Registers the blog class using the name blog <?php /** * @var $hook Hook */ $hook->trigger("blog.hi", "Ryan");
-
actually "add" should be "assign", it is from my template class, and I can not have a second template instance so, my: Hook extends Cleep extends Template extends Base. I don't really understand your example, there isn't enough information.
-
I am kinda stumped or maybe even confused.... But with what you guys are saying, I have the following: /classes/Hook.php <?php class Hook extends Cleep{ public $listeners = array(); public function __construct(){ parent::__construct(); } public function register($name, $callback){ $this->listeners[$name] = $callback; } public function trigger(){ $args = func_get_args(); $argNum = count($args); if($argNum < 1) trigger_error("Insufficient arguments", E_USER_ERROR); $hook_name = array_shift($args); return call_user_func($this->listeners[$hook_name], $args); } } /includes/setup.php $hook = new Hook(); foreach($plugins as $plugin){ $plugin = $plugin["directory"]; $file = __DIR__."/register_plugins/$plugin.php"; if(is_file($file)){ require_once $file; } } /includes/register_plugins/$plugin.php $hook->register("hi", function(){ $this->add("CONTENT", "Hello! I Am A Blog"); }); The part I am stumped on, is how can I use $this->add("CONTENT", "Hello! I Am A Blog"); because I am getting this: Fatal error: Using $this when not in object context in /includes/register_plugins/blog.php on line 4 Am I doing something wrong or missing something?
-
make your background image smaller, it will load faster, and use less bandwidth.
-
here is what I did: foreach($plugins as $plugin){ $dir = $plugin["directory"]; $filename = "plugins/$dir/index.during.php"; if(is_file($filename)){ require_once $filename; } } I don't know if it is a good method or not, but in index.php this code runs in the middle of the page, it calls index.during.php and executes the script in there. That script is a procedural script that runs how ever it is programmed. Now I have come to another question... how would you make a plugin for a plugin? For example say I make a "Blog" plugin it has an entire blogging system built. Now lets say to my blog I want to add a poll system so people can vote for something. Any suggestions on an approach to do that?
-
In my Netbeans editor, I get this warning, when using a variable that is defined in an included file: Variable $name seems to be uninitialized Anyone know how to make Netbeans see that it is in fact initiated in the file that is being included? config.php <?php $temp = new Template(); index.php <?php /** * @var $temp Template */ require_once "config.php"; $temp->display("index.tpl"); In my above example, in index.php $temp says Variable $temp seems to be uninitialized and yet it is but in the included file. adding the @var turns on auto complete, in the file for $temp, but the variable still shows it is uninitialized. So, Anyone know how to turn it on in Netbeans?
-
you could also follow a photoshop tutorial and make something you like: https://www.google.com/search?q=photoshop+header+tutorials That is what I usually do, the tutorials are usually really easy
-
I have the 2nd Gen Zune (has the pad on the bottom), and it works great! The only issue I have with Zune is you can not connected it to your car stereo and control it through the stereo like an iPod. If I were to use something connected to my car speaker I would use a phone, unless the new Zunes have Bluetooth.
-
my best guess: https://maps.google.com/maps?q=1417+North+Semoran+Boulevard,+Orlando,+FL&hl=en&ll=28.564941,-81.310815&spn=0.001279,0.002642&sll=28.536275,-81.298828&sspn=41.547926,86.572266&hnear=1417+N+Semoran+Blvd,+Orlando,+Florida+32807&t=m&z=19&layer=c&cbll=28.564941,-81.310815&panoid=Z1uv0Hd5DGHfdNO9IWRhhA&cbp=12,88.02,,0,2.01
-
I am thinking of creating an application that allows for user plugins to extend the functionality of the application. I have written one before, but I am not sure if it is a good way of doing it. Any suggestions on how one could be created, and best practices for making one?
-
- Query optimizer :: analyzes your queries and database to optimize queries. - Hack Testing Site :: (Safely tests sites for security issues) You give it a website and it tries to hack it. It then Emails you the results, and how you can fix the issue. - Categorizer :: Give it a document and it assigns 1 or more categories to it (Science, Math, English, Programming, etc.). Sub-Categories would be cool too. - Niche Search Engine :: A search engine that searches a persons niche. - rock paper scissors lizard spock That is all I can think of ATM
-
In the logo function you have extra spaces after: HEREDOC; Their can be NO white space after or before it!