Jump to content

Joshinki

Members
  • Content Count

    11
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Joshinki

  • Rank
    Member
  1. Sorry, typo - I did mean $_POST
  2. <?php $timestamp = strtotime($_GET['time_input']) + 60*60; $time = date('H:i', $timestamp); echo $time; ?> $_GET['time_input'] will be the name of your textbox in your form.
  3. Joshinki

    MVC

    Hi Ignace, Yes I understand that, but it my logic in thinking correct with the image above? I was looking into this design pattern just to help update my future projects easier. Why use a framework over just coding it from scratch as above?
  4. Joshinki

    MVC

    Also, where you have: $images = require APP_MODEL_DIR . '/gallery/getAll.php'; Could I put this into a model file? and use like: controller/gallery/index.php <?php require_once 'models/gallery/model.php'; $model = new Model; $images = $model->fetchImages(); require_once 'views/gallery/index.php'; ?> models/gallery/model.php <?php class Model { private $pdo; function __construct() { $this->pdo = Database::getInstance(); } function fetchImages() { $st = $this->pdo->prepare("SELECT * FROM GALLERY"); $st->execute(); return $st->fetchAll(); } } ?> And then my view/gallery/index.php will be as above on image?
  5. Joshinki

    MVC

    Thank you so much for that response, very helpful! Just so I understand it visually tho, is this correct the way I have drawn it up?
  6. Joshinki

    MVC

    Thankyou for all your replies. @Diversity Yes this is something custom, I wanted to get my head around this before moving onto a popular framework. @ignace Thanks for that, So what your saying is load the Gallery Controller, and in the gallery controller -> gallery model -> this would then output the gallery views? How is my template incorporated into this? ie - I want my header/footer to be loaded, and then gallery images to be loaded in the body. Thanks
  7. <?php $gplus= 344; if($gplus >= 1 AND $gplus < 49){ echo "Get answer 1."; } else if($gplus >= 50 AND $gplus < 99) { echo " Get answer 2."; } else if ($gplus >= 100 AND $gplus < 199) { echo " Get answer 3."; } else if($gplus >= 200 AND $gplus < 499) { echo "Get answer 4"; } else if($gplus >= 500 AND $gplus < 999){ echo "Get answer 5."; } else if($gplus >= 1000 AND $gplus < 1999){ echo "Get answer 5."; } else if($gplus >= 2000 AND $gplus < 2999) { echo " Get answer 6."; } else if($gplus >= 3000) { echo " Get Answer 7."; } else { echo "We didn't find any answers."; } ?>
  8. Joshinki

    MVC

    Hi, I am still struggling to get my head around MVC. I have drawn something up in powerpoint just to see if my thinking is correct? If you could let me know if this is correct or am I on the right track? Thanks Josh
  9. @Jacques1; Slight off subject to my post, but since you had mentioned Front Controller ect, I have been reading more into MVC. I have checked some guides/tutorials on this and came up with: https://github.com/Joshinki/php_mvc/ Took abit for me to get my head around it, Only question I have that I couldnt really find an answer on is a controller for every part of the site? (Login, Load News Article, Load Navigation) So you would have a seperate Controller on your homepage to view news ect, then another for loading a navigation?
  10. Hello @Jacques1, Thank you for your response, really appreciate you taking the time to view my project over! 1st Bullet - I didnt really understand - Are you suggesting that the way I am including PHP pages into another page is not the way to go? 2nd Bullet - Will take note of this, will change this now. 3rd Bullet - Would this index script pull the classes together then? Thanks again!
  11. Hi guys, Hope you can help me! - I have been trying to learn php just from reading/trialing and error ect, also read that github is good for posting my projects so people can see ect. So here it is: https://github.com/Joshinki/php-new Could you let me know if I am on the right track with doing things? I know there is not much PHP in at the moment, but with placing of the classes ect Thank you for your time. Josh
×
×
  • 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.