Jump to content

redbullmarky

Staff Alumni
  • Posts

    2,863
  • Joined

  • Last visited

    Never

Everything posted by redbullmarky

  1. ok cool. I guess the only thing i see with helpers is that they're not really part of the template. Aside from seperation that MVC gives, I guess I kinda subscribed to the logic that templates were supposed to be predominantly HTML wheras when i employ helpers, I'm essentially introducing code into the template and HTML into the code (ie, HTML into the helper). I don't have any major issues with this (in fact, doing the page itself isn't really the problem) - the issues I guess come when trying to do things the "right way" which has so far served me well in terms of making changes. oh well. Helpers prob the way to go - possibly something like <?=$article->render($articledata) ?> and <?=$article->renderList($articles) ?> - unless i'm missing something easier/cleaner. put it this way - as long as it's easy to maintain, easy to use and easy to re-skin without sifting through clumps of logic and code, I'm sold even if i break a rule or two.
  2. possibly, though i'm trying to keep any form of HTML generation (bar things like BBCode, Smilies, etc) out of my controllers/libraries/helpers, etc.
  3. Hi all Just after some ideas. I'm looking at setting up a module for my framework that will support different sorts of articles in a flexible layout. Consider this page: http://news.bbc.co.uk/ - this is ideally what I'd like. My only issue is when I've tried "MVCing" the bits and pieces to pull a page like this together, my templates do kinda get cluttered with tonnes of PHP code (mostly "view" logic like foreach's and echos etc, but still - it looks more PHP than HTML). If it was just a simple, 1 column list of articles, it wouldnt be an issue - just a standard foreach - but I wanna move on from that. I've also considered the idea of having a "grid" (prob made of a TABLE, for argument sake), each cell would echo a variable containing the article's HTML. But in terms of MVC, this would mean that my controllers would be handling too much in terms of the way the page looks. I'm not interested in other technologies (XML/XSLT, etc) at this point - I'd just like to get a few ideas of how i might tackle this. Im one of my sites, I've gotten something along the same lines: http://www.holdingthebaby.com/articles/dads/ although it's not as busy and not as flexible, and even THIS one uses a good chunk of PHP in my templates. Any thoughts? Cheers Mark
  4. dunno, but spamming me a "you have been invited" link like you did the other day is DEFINITELY not the way...
  5. have you got your local version of PHP installed correctly?
  6. haha ok i actually find it fun to work with, mainly because i can concentrate on just getting the job done with it rather than having a major headache at learning how to use it. anyway - welcome to the boards as you were
  7. doesnt look too bad. maybe a few tweaks: 1, make the logo into a link to the homepage. 2, move 'Clients' out of the navigation as it's not really a focus aimed at new customers or relevent to your services. 3, change the font of your footer copyright message 4, portfolio in the nav is a dead link. portfolio.php works, but you've got iportfolio.php 5, the flash header is unnecessary and very jerky. try avoid using flash just for using flash's sake. the 'designer vision' text could be incorporated into the logo itself. 6, you have those blue and green panels. for some reason, having them centered doesnt look right - IMO I think they need to take the width of the screen in 2 columns (or better, 3 if you have something else to put there) 7, it strikes me as a tad bland due to lack of any images. maybe a few images from here might help hope that helps
  8. if youre using PHP5, then have a look at Exceptions otherwise, take a look at set_error_handler() and trigger_error()
  9. not as tricky as it can seem. all it generally involves is download.php retrieving the file info, sending the necessary headers and presenting the file just like any other type. i'm a bit rusty with headers and things, but something like: <?php $upload_dir = $_SERVER['DOCUMENT_ROOT'] . '/uploads'; $filename = $upload_dir . '/myfile.zip'; // send the headers header("Content-Disposition: attachment; filename=\"".basename($filename)."\""); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); // read the file contents to the output buffer readfile($filename); exit; ?> will do the trick. in this example i've assumed that you keep your files in www.yoursite.com/uploads although i wouldnt recommend it, to prevent direct linking to the files themselves. the good thing about scripts like this is they can serve a file from wherever - ie, not necessarily within your web root: - httpdocs/htdocs - index.php - download.php - css ...etc... - uploads ... uploaded files here. CANNOT be accessed directly from browser - only the download script. in the above case, you'd simply change the $upload_dir to suit, such as /var/www/uploads or wherever you keep the directory. good luck
  10. i cant answer your others, but is there a reason why you'd want an actual live host for all this stuff? much of what you're trying can be set up on your local computer easily enough, or even better if you've got an old spare computer kicking around that you could set up as a server just to try stuff out on. it'll save you a few quid in hosting fees, too considering you're just really using it to mess about on. Failing all that, get a VPS and you can install whatever you like on it.
  11. basically, yes - tho most/many posters there publish their email address either on the advert or within their profile.
  12. where are you trying to reply? there are a few boards where nobody can reply, one of them being the Freelance board, another being the "FAQ/Code Snippet Repository". If it's a freelance question, send the person a message directly.
  13. not to $_GET, but it tells the page, once rendered, to go to the anchor named 'somemodifier'. Commonly, anchors are used in FAQ's - when lots of things are listed with a table of contents at the top where you click on an item and the pages moves down instead of following the link to another page. <a name="somemodifier">Here</a> so if you had that link in your HTML, and called the page with that modifier, the page would shift down to where the anchor is placed.
  14. it might be more of a logical thing... your while loop says if the attacker OR the victim are alive, keep going. now - if either die, surely the other one cannot be killed as the only one that COULD have killed them is dead. hence a never ending loop. what i think you need is an AND: while ($attacker->isAlive() && $victim->isAlive()) { which would mean that whilst both fighters are still alive, keep fighting. right?
  15. myharshdesigner, please provide the code you have already tried. if you wish for someone to write the complete code for you, then try posting for paid help in the Freelance board. A Google search for PHP and CSV will provide you with the resources - there's no point getting code if you're not going to be able to understand it, as you'll end up with tonnes more problem down the line.
  16. as having the 'ext' extension will also find 'gif', it's probably fair to say the extension is negligable. let's say that $search contains what you're looking for, and the array $haystack contains the data. first we'd get rid of the extension, then we'd make the $search and $haystack elements "common" - ie, take out all the characters that don't matter and put it all in the same case: <?php $search = 'pictures_of_something.ext'; $haystack = array ( 'pictures-of-something_1.ext', 'picturesofsomething2.ext', 'myfile.ext', 'WeIrDcAsE.eXt', 'stupid file name.ext' ); // simple function to convert filename to lowercase alpha, without extension function getCommon($file) { // get filename part in lowercase list($filename, $ext) = explode('.', strtolower($file)); // remove unwanted stuff $filename = preg_replace('/[^a-z]/', '', $filename); return $filename; } $needle = getCommon($search); $results = array(); // our results will go here // now check each array element foreach($haystack as $item) { if ($needle == getCommon($item)) { $results[] = $item; } } // output results! echo '<pre>'; print_r($results); echo '</pre>'; ?> as it's used a fair few times, i've put the "common" converter into a little function called getCommon. what that does is removes the extension (as we don't really need it for sake of search), leaving us with a lowercase filename. then we just strip out all the characters from it we don't like - so if you search for "pictures_of_something.ext", then it gets converted into "picturesofsomething". Running the first two elements of the $haystack array will also return "picturesofsomething" and voila - 2 matches. Hope that helps
  17. we are not prepared to do your examination project for you - i'm sure people will agree that this defeats the point of having exams in the first place... topic locked
  18. redbullmarky

    Hello

    lol it's cos you lot down there consider the Midlands just a place to drive through to get somewhere interesting so you miss all the fun and dialect sorry, marf - 'ow am ya? seriously, have fun. I knew virtually nothing when I joined here but have had tonnes of help myself, so enjoy
  19. redbullmarky

    Hello

    haha almost sounds Yam Yam
  20. Google came up with this: http://www.colostate.edu/~ric/htpass.html as for your question - no they wont unless they enter a valid username/password.
  21. I agree with nameless on this one. Not having a fair understanding of your tools is one sure way of creating a security nightmare. I had a look at SAJA - just seems a bit too "jack of all trades" for simplicity sake. Prototype/Mootools would involve you to get down and dirty with JS, but because of the way they're written+structured, it's not as mundane/hard as you may think and come with tonnes more features.
  22. redbullmarky

    Hello

    welcome to the forums!
  23. very true. i tend to use them for smaller objects (such as icons) so the difference is negligable.
  24. ? seems like a sensible question to me... PNG's I generally find better, due to the fact that they tend to blend into their background better whereas GIF's kinda need to be tailored depending on the background and its colour. (or at least they do with my GIF's/PNG's ). The problem with PNG's is their support in IE6 and their background transparency. There are fixes of course, but they generally involve bits of javascript. If PNG support was spot on across all browsers, I'd use them 100% instead of GIF's.
×
×
  • 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.