Jump to content

Redroest

Members
  • Content Count

    150
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Redroest

  • Rank
    Member
  1. Well some frameworks apply the method I just told. I guess it depends on what is important. Smart technologie or performance
  2. Hey people. Im stuck again.I am building a framework based on the Model View Controller principe. My model has an query function like below: <?php //Load all default modules public function getBlockModules() { $sql = 'SELECT * FROM core_modules WHERE blockMode=1'; if(!$ModuleQuery = $this->db->query($sql)) { trigger_error('Error in the modulequery: '.$this->db->error); } else { $rows = array(); while($row = $ModuleQuery->fetch_object()) { $rows[] = $row; } return $rows; } }?> And my controller function to retreive data looks like this: <?ph
  3. Well, try to make a navigation structure in your website. For exampleindex.php <?phpinclude './config/config.php';include './libraries/output.php';include './libraries/session.php';if(!$_GET['page'] == 'picture'){ include './libraries/siteDB.php'; $dbConn = new siteDB;}else{ echo 'My image'; echo '<img src="image.png" alt="image" title="my image" />';}?>
  4. Redroest

    MVC model

    Ok here's the problem. I am trying to make a model object for my system. I'm trying to work step by step so things like a registerclass and a controller etc are not yet implemented. First of all the procedural code: <?phperror_reporting(E_ALL);$included = true;//configuration globals//This will be arranged by the registry object later on$host = "localhost";$username = "root";$password = "";$database = "core";$dbprefix = 'core';//Load classfilesinclude('classes/class_database.php');include('classes/class_module.php');include('classes/class_layout.php');include('classes/class_model.php
  5. Ah ok, thanks. Its important for me to know that. I never learned php from an education. Its just something I learned in my spare time.
  6. Cool, so I finally seem to get it now :)But how would you implement the optional parameter in the constructor then?
  7. Hello, I just made an moduleclass which loads files using filelinks and combines it with a layout. I just want to know, is this a correct OOP class? And do you people have any hints on how to make this better? <?phpclass module{ private $controllerFile; private $headerFile; private $title; public function __construct($controllerFile, $headerFile = '', $title) { if(is_file($controllerFile)) { $this->controllerFile = $controllerFile; } if(is_file($headerFile)) { $this->headerFile = $headerFile; } if(is_string($title)) { $this->title = $title; } } public
  8. Aw omg I made one little error. I've been struggling with it for over 2 days now and now suddenly it works just as you say.. Don't really know what went wrong though!Thanks anyway
  9. Well is it possible to group the buffers? like below??? <?php//Start primary bufferob_start('primary');//Start secondary buffer (for example in a function)ob_start('secondary');//End secondary bufferob_end_clear('secondary');//End primary bufferob_end_clear('primary');?> On php.net they say that ob_start() is a function that nests.. like: <?php//Start primary bufferob_start('primary');//Start secondary buffer (for example in a function) //This will output the first bufferob_start('secondary');//End bufferingob_end_clear('secondary');?>
  10. Make sure not to forget security (mysql_real_escape_string etc)
  11. Hey, I am working on a system that includes modules by using outputbuffering. The following function loads files from modules. The output generated by the module will be checked for so called "custom tags" and replaces them with modules. These modules will then be included into a template for example. <?phpfunction file_to_var($file){ if (is_file($file)) { ob_start();//Load the modulefile include($file); $content = ob_get_contents(); ob_end_clean(); return $content; }}?> This code works fine to me, but there is one problem. I just made a module in another system. This system has
  12. I know thats the way I used to work, but this does not work also:function callback(xmlhttp){ var output = xmlhttp.responseText; return output;}Is there a way to simulate this ?
  13. Hey people I am trying to make an AJAX object that returns its values to a variable. Every time when I try to alert the output from the server it says undefined or [Object]. When I alert the xmlhttp.responseText within the sendRequest function it works! var XMLHttpFactories = [ function () {return new XMLHttpRequest()}, function () {return new ActiveXObject("Msxml2.XMLHTTP")}, function () {return new ActiveXObject("Msxml3.XMLHTTP")}, function () {return new ActiveXObject("Microsoft.XMLHTTP")}];function GetXmlHttpObject() { var xmlhttp = false; for (var i=0;i<XMLHttpFactories.length;i++)
  14. Simply said: real_escape_string is for making a legal query to INPUThtmlspecialchars is used for legal OUTPUT to your html/xhtml
  15. Redroest

    Moduleclass

    That was my original way of thinking synook. But I used this in an function oriented style and it gave the modulebuilder strict giudelines on how to make a module. So when I inserted something like a photoalbum that was used on many other websites it had to be rebuilded before I was able to use it.
×
×
  • Create New...