Jump to content

redbullmarky

Staff Alumni
  • Posts

    2,863
  • Joined

  • Last visited

    Never

Everything posted by redbullmarky

  1. Example303, I do kinda get the impression you're either on a windup, a postcount competition, or really are trying to run before you can walk. Either way, I warned you yesterday about obscure posts that don't help others understand your problem - there are people trying to help you that would be better off helping others that at least bother to try and explain their problem properly. Either sort out your future posts, or just don't post at all.
  2. dynamic variables can be constructed using braces after the $, so: <?php $animal = 'dog'; ${$animal} = 'woofs'; echo $dog; // output: woofs ?>
  3. this is why new coders seem to find Ruby on Rails "easy" - they're learning the whole thing, including the framework/MVC and the actual language all from the off. As you said from the start, "teaching an old dog new tricks" is pretty tricky but definitely possible - and yet it depends on how you're doing things already. What I like about some of these MVC frameworks (Cake included) is the way they deal with the view. Some people are used to the whole [pre]include('header.php')[/pre] and [pre]include('footer.php')[/pre] style of coding - what Cake does is to have a sitewide standard "outer" template (called a 'layout') that contain all your doctypes and basic structure, etc and the inner changing templates that hold your page content (views). The 'view' is automatically chosen based on the 'action' name within the controller - so calling the login action within the users controller (uri: mysite.com/users/login) would look for the file called '/app/views/users/login.thtml' or something like that automatically. All that said, it's generally a totally new method to lots of people that's hard to grasp at first. As we all like to "see" things happening, you can safely sod the model for now. From the way I picked it up and went through the confusion, I'd suggest getting to grips with everything on the Controllers page as it pretty much covers EVERYTHING you need to get a working site (including interracting with views). In many ways, even if you decided to ignore the rest of the whole framework, you could still put together a fully fledged site knowing everything on that page. Once you're up to speed with that, then the Model and other areas will make LOTS of sense Good luck!
  4. John - take a little step back a minute dude. I consider you very knowledgable in this field and I kinda understand half of what you're on about - but skip back up to Ronalds original post and you'll see that - absolutely no offence to Ronald - things need to be put into a bit more simplistic terms - even for my own benefit Consider the fact that not everyone cares much how extensible/fast something is - as long as it does the job nicely and comfortably and enables them to learn, that's all that's required. Be honest - Zend Framework is not for the feint hearted or the learner, as it's very advanced and hugely easy to get very very lost indeed. Learn to walk before running, etc, etc. For me, heavy OOP and best practices are the deep end of the swimming pool. At the other end is something simple like a templating engine, a bit further on you have code igniter, a bit deeper you have cake then maybe symfony. Diving into unknown territory without picking up some of the basics and terminology first is one surefire way to get pissed off and give up altogether. At college when I was dabbling in C++ and trying to make a simple graphical game, one of my fellow students suggested I started writing certain routines in Assembly language "because you'll save several ticks of the clock cycle hence fully optimising the routine making things run about 9000 nanoseconds quicker". If i'd have jumped into assembly there and then, I'd probably have gotten out of coding altogether....
  5. Example303, phpfreaks is a place to get help from others, not a competition to see who can post the shortest or most obscure posts that noone can understand properly - i'm talking about you generally too, not just about THIS topic. Either be more specific, or just do you own research.
  6. by the 404, i'd guess it's a disaster already happened...
  7. well I could safely say the traffic volumes for phpfreaks isn't too shoddy, so I'd suggest SMF. I'd be keen to see what phpbb come up with in their next version, but as it's a rewrite, it's just too new for me. SMF on the other hand is strong, customisable, and has a proven history behind it.
  8. same for me. it errored out with a PHP error when I put <?php echo 'test' ?> (ie, without the ending semicolon) but when i put the semicolon back it didnt display anything.
  9. with frameworks like Cake, you'll find many scripts on their site to simply download a plug in - whether there's a shopping cart, i don't know but otherwise, it wouldnt be that different to any other type of integration. If you need to break the MVC pattern sitewide to integrate something, then so be it. CakePHP and CodeIgniter keep plugins/extensions seperate - so adding a new one is pretty much a case of throwing it into the plugins/components directory and then it's available to use. You could do worse than setting up Cake and playing with it, even if just following through the blog tutorial that's on there. I'd say take an hour or two to learn/suss out how to install, and about the same again to fully complete and understand the blog example. Look at the RubyonRails screencast too - Cake is based heavily on Rails, so the priciples are almost identical. Seriously, I know what position you're in - only not so long ago, I was exactly the same as you but then it just kinda clicks and you just get it. Hold on in there - the benefits are HUGE
  10. you could use AJAX if there are quite a few categories. I couldnt point out one tutorial over another, but a quick google search on ajax and php will bring up quite a few. Also the AJAX forums here: http://www.phpfreaks.com/forums/index.php/board,51.0.html and the main phpfreaks site itself are also good starts.
  11. (off topic: not sure what happened, but the word 'model' was being blanked out...I filled in the gaps, which was like doing a newspaper puzzle ) anyway...this is no disrespect to Eric_Ryk for his explaination or Ronald for not getting it, but sometimes I think half the problem with MVC and frameworks (and patterns, for that matter) is the way they're explained. Personally, I remember asking these same questions and scratching my head at the same answers. So I guess it might be easier to explain the benefits I've found... I'm sure we all remember our first scripts. You'd have a HTML page and above the doctype, you'd throw most of your PHP code, and in between the HTML you'd throw more PHP code to display whatever. After a while, you got bored of the site and wanted to give it a nice new lick of paint. Only - the problem was, all the HTML is mixed up with your PHP. Whilst copy and pasting is all good and well, it takes a good chunk of time. So then you discover templating (be it Smarty or a pure PHP version) and realise that you can seperate your main code from your templates. If you need to change the functionality then, all you need to deal with is PHP. Wanna change the look? no worries - just change a template without worrying about buggering up your code What you've essentially just done is seperated your logic (M+C) from your presentation (V). The next step I guess is just clearly defining two areas - the Model and the Controller. If for example you want to move your database to MSSQL or PostGreSQL or even text, or even change the table structures (just the same way as you might change your sites style), then you need to sift through all your code thats responsible picking out that code concerned with DB access and change it to suit. Seperating this from the off means if you want to change the way your database is accessed or handled or even the database system altogether, you're just dealing with the Model without breaking your actual code. So to me, the seperation means: - everything is very organised - I can change the look of the site without breaking the site itself - I can change the way the database is handled or even restructure/rename my tables without breaking my site - I can change the operation of the site without worrying if i'm breaking my database or the HTML The CakePHP way of handling databases is fantastic. To kit out my database table with all the methods I need, all I need to do is set up a model file only a handful of lines long that extends a base class, and I'm set to go. Even table joins, etc - you might just do: $post = $this->Post->read(null, $post_id); and your $post var will not only have the blog post in question, but all of the comments belonging to that post, too. Ok, it's a lame and cliched example, but how many times to you deal with table joins, etc and then format the results afterwards to get them in the right way and how much code does it take? or how many times do you set up little functions that will, for example, turn a user_id into a username? the list goes on, but essentially all that has just taken one line. Odds are, you'll probably use exactly the same structure for your Posts or Users tables etc in another site - no problem. Just copy the model over, and you probably wont even have to make changes to it either - it'll just work Since I wrote my first site using my framework, I've not had to write either a login system or article system since. I just use the same one As for patterns - if I'm honest, I dont have a bloody clue other than MVC, though in using a framework, I'm probably using them without either knowing or knowing what they're called...Personally, I don't think it's important to have a full knowledge of design patterns to be able to benefit/enjoy working with MVC frameworks. In summary, MVC = nice way of organising and making changes to parts of site without breaking other parts. Framework = nice way of ridiculously speeding development up by allowing you to concentrate on site specific code rather than mundane tasks that you do each and every time.
  12. we're not here to do your homework, and considering "false qualifications" rub me up the wrong way anyway, I'm definitely not - especially as what you're asking is covered extensively via a Google Search. By all means post back with code that you've tried yourself and we'll happily help you. Otherwise, your best option is to probably just ask one of your classmates for help...or follow roopurt's advice Topic locked.
  13. i dont think their is a difference. The options these days generally fall under a) shared hosting b) Virtual Private Server (VPS) or c) Dedicated server. shared hosting is where a company cram as many users onto a single system as possible with their own domains, hoping that nobody will run a script that'll bring the lot down in one go, so they can make as much money as possible whilst providing minimal support. Run a script on a shared server that amounts to: while (1==1) {} and see how you cant get through to phone support because the "lines are extremely busy at the moment", and then you'll quickly realise that roopert's suggestion of getting a VPS or a dedicated server is genius.
  14. you definitely need to check what's being passed in via the URL. example: http://development.mooseinc.net/software/1/index.php?id=../../../
  15. as taith said, get/post/cookie are really your only options. Personally, if I want to pass info into a popup, just use the URL unless there's a reason why not: so instead of just: help.php , you'd have help.php?var=value&anothervar=anothervalue then just use $_GET to pick them up from within help.php itself.
  16. maybe it's just me but I really don't follow...can you try and explain differently? maybe give an example of exactly what you're trying to achieve?
  17. your class differs to your example. In Session::login, this: $this->userid = $_SESSION['userid'] = generateRandID(); should be as it is in your first post: $this->userid = $_SESSION['userid'] = $this->generateRandID();
  18. it goes by post count rather than time you've been here. not sure exactly what that amount of posts is, but don't be posting like a nutter to try and get your title changed
  19. no. the output from that would be 'Hello Mars | Hello Mars' you're setting up $a with 'Earth' as the value, then making $b reference $a - therefore, changing $a will also "change" $b too (and vice versa). to get the output you specified in your example, remove the & . Then, $b will be set up independently of $a with $a's value.
  20. wrong place. "PHPFreaks.com Questions, Comments, & Suggestion" is for stuff related to PHPFeaks itself... moving to OOP help as & generally used more in that area... as for your question, $name = new test(); will instantiate the class called test. $name = &test() as far as I know is pretty useless. the & operator in PHP is used to reference something (as opposed to copying it). eg: <?php $a = 'Hello'; $b = $a; // copy - so create a totally new var $c = &$a; // reference $a = 'Goodbye'; echo "$a, $b, $c"; // will output: Goodbye, Hello, Goodbye ?> make sense?
  21. i'll be one of those people - however, don't underestimate CodeIgniter as a framework in itself. When I personally state that it's a good stepping stone, I mean it in terms of the fact that CodeIgniter is just simple and well documented in comparison. Doesn't mean you're a "noob" if you stick with CodeIgniter - far from it - it still comes with the learning curve, but also comes with tonnes more out of the box than Cake In terms of "How much framework do I need?" - the answer is simply "As much as you need to achieve the goals properly." As for: what i've grown to realise is that most things bigger than a "Hello world" type script warrants an MVC framework, as it's just so much easier to keep ontop of long term. As for "full blown" - depends on what you consider full blown. Most of the frameworks out there seem full blown to start with, as they can be quite intimidating - but once you get used to them, you'll be laughing at how much easier it is. In terms of the position turnover you mention, a person filling your shoes is much more likely to be aware and comfortable with Cake than CodeIgniter due to how long it's been around. But what I like about the both is they're very similar - so swapping between the two is quite an easy affair. Hope that helps Cheers
  22. ditto with what Andy said. Unfortunately, there's really no way of enforcing it. I take most of my pleasure knowing that, even though the OP might be ungrateful and never come back again unless they're ready to take-take-take again, someone else will read it.
  23. I'd guess that the answer will probably be a no If a new board or sub-board was created each time to compensate for people who can't or don't read guidelines, then this would turn into a messy (and HUGE) place
  24. can you post the code you've tried already? c'mon lad, you know the rules...
  25. not every board has a solved button. This one, for example, doesnt - only those that have a real need for it has it (eg, PHP Help, OOP Help, MySQL Help, etc)
×
×
  • 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.