redbullmarky
Staff Alumni-
Posts
2,863 -
Joined
-
Last visited
Never
Everything posted by redbullmarky
-
in addition - a nice new function exists called 'get_called_class()' class A { function test() { echo get_called_class(); } } class B extends A { } B::test(); // outputs 'B'
-
just to report back - the new 'static' reference does in fact work. Tried on PHP6 so assuming 5.3 would be fine too <?php class A { function test() { echo static::$hello; } } class B extends A { static $hello = 'hello world'; } B::test(); // outputs hello world ?> whilst playing around with this, and seeing all the issues i've had in versions prior to 5.3, i'm pretty excited about the final release.
-
i tried the get_class($this) already. googling around seems to show up many of the same issues, but any fixes suggested are very hacky. upgrading PHP now to a dev version now - PHP5.3 at least will be released by the time i've finished developing this bitch of a project lol . at least then i can upgrade my live server so my dev stuff will work, which has been the only thing that's stopped me so far.
-
brilliant I agree. Also, not only can you base it off unique features of your site, or what your site does, you can also base it on your user-base, or intended user base. This site is an example - PHPFreaks. Think of 'bored.com' too - lots of games and videos, etc for those just doing some lazy surfing. try and avoid any cliches or obvious rip-offs. you need to be unique. myspace, facebook, etc - they've been done. so stuff like myface or facespace or faceplace are rubbish (unless you just want to set up one of those dumb holding pages). even obvious ones like missing the last 'e' out, or whatever, like 'Flickr' - it's been done now, so avoid. It just makes you look cheesy. With all that said, it really isn't important to name your site or buy the domain until everything you need is planned out in detail, or maybe not even until the site's been finished and almost ready for go-live. Maybe once you actually see it running and play with it, or you get some friends to test it, you'll have a better idea for a name.
-
*bump*
-
need a free web host.... please help cheers.........
redbullmarky replied to redarrow's topic in Miscellaneous
dude this sort of question would have been more valid 5 or 10 years ago when hosting prices were higher and it was slightly acceptable to use stuff like geocities, but these days lots of packages are almost literally costing peanuts and are affordable regardless of income and/or any other reasons. maybe there are free ones out there that are ok, maybe not - but unfortunately, nothing these days is completely free... as there's a sticky on hosts already (here, albeit a mixed bunch, not just free ones) i'm going to lock this one. -
Hi all First a bit of code: class Model { static $test = 'hello'; public static function table() { echo get_class() . '<br />'; // outputs 'Model', not mUser echo self::$test; // outputs 'hello', not 'goodbye' } } class mUser extends Model { static $test = 'goodbye'; } does anyone know how it's possible to get the final class name (ie, 'mUser') from within my table method? calling mUser::table() outputs results i'm not really interested in...it's important for me to keep the child classes as empty and basic as possible, so if anyone has a clue or any clean workarounds, let me know Cheers Mark
-
Google for "php cms" will turn up loads. A quick look here will turn up most of them - including the most popular, etc - and allow you to demo them to see if they fit your requirements.
-
Main site bug reporting
redbullmarky replied to GingerRobot's topic in PHPFreaks.com Website Feedback
additionally, the http://www.phpfreaks.com/blogs page seems to lose the author's "real" name underneath the subject. ie, Daniel Egeberg instead of Daniel0 (if specified in the user's profile) -
Main site bug reporting
redbullmarky replied to GingerRobot's topic in PHPFreaks.com Website Feedback
not a bug, but more a readability issue - i'd like to see the figures thrown through 'number_format' or whatever to drop some comma-seperators in there. eg "553,589 forum posts" instead of "553589 forum posts", etc. -
one that's simple and not broken and allows you to admin your stuff. simple as that
-
one possible way i've stumbled upon to get a collection of objects is possibly via the use of PHP5's object iterator: http://uk3.php.net/manual/en/language.oop5.iterations.php Which would allow me to effectively run a foreach on a resultset object to return CRUD objects one by one as required, without instantiating one for each result in advance.
-
yeah i've taken a look at a few, but generally they look quite "excessive" whereas i suppose (although my description above probably doens't show it ha!) I need something very very basic that I can plug in easily and just keep adding functionality to along the way as I need it. I suppose also that it's a little exercise for me too to get something nice like this working myself, as the rest of my framework is custom code. so i guess I'm just trying to find out how "expensive" it is to have each record represented by a CRUD-type object, each table represented by a "manager" object which can find rows and return these CRUD objects. thanks for the suggestion though - if nothing else it'll perhaps give me a few ideas. I just love the way Django does it though - very powerful but incredibly simple.
-
Hi all Just wanted to get some thoughts from those experienced with ORM. I've been looking at both Django and Rails a bit more recently with a view to getting ideas for a newspaper CMS I've been building, especially with regards to Django's automatically generated admin interface. I know I could use Python and Django for what I'm doing, but there are many reasons why I want to stick with PHP... The idea: I have a "manager" class which handles retrieval of records from a database table. I'd expect to have a 'find' method and a 'load' method. The find method would be concerned with finding multiple records where as a load would be concerned with returning a single record. The loader would return an object that could be accessed with 'save()', etc methods, the finder would return an object which would enable iteration through these sorts of objects. Hope that makes sense, but examples of all: <?php $u = UserManager(); $records = $u->findAll("created_at > $sometimestamp"); while ($record = $records->next()) { echo $record->username . '<br />'; } $user = $u->load(1); // load record 1 echo $user->username; $user->username = 'test_person'; $user->save(); $user = $u->create(); $user->username = 'another'; $user->password = 'password'; $id = $user->save(); // etc // etc ?> my questions: 1, is there a better, cleaner way of implementing Row Data Gateway / Table Data Gateway in PHP, considering the handy features PHP lacks that Ruby/Python have? 2, does anyone have a clue what performance is like? Consider, for example, I want a list of 20 articles on a 'list' or 'archive' page, i'd need to run the 'manager' to get 20 results, each of which would in turn be represented by a new object? Cheers Mark
-
whether someone gets all their answers via Googling for them or all their information via Wikipedia, makes no difference to me personally. The question gets answered all the same and it's still very helpful to have someone give you a hand researching something. So basically - as long as someone is helpful and sticks to the rules, they stand out with those that actually vote. Doesn't guarantee a position or anything but it gets a discussion. Listen - main thing to remember is that whatever we do, there's always gonna be those that don't like it. The main site isn't launched yet - but I know some wont like it even before people have even had a sniff. It's just the way it works, so lets agree to disagree and say that this is the way we are doing things right now and this is how it's gonna stay for the forseeable.
-
sucking up to the admins is exactly how NOT to get an "impressive" title. Not one single member with an "impressive title" here got it by asking. They got it by sticking around, providing helpful answers and a whole load of other things. Not sure who pissed on your chips, but making wild blanket statements that "most" of the mods arent smart just makes you look a bit silly. For one thing - being a moderator does not automatically mean that we're smarter than you or dumber than admins. It's not even about glory or status, as it's purely based around what we can and can't do around the site. Someone has to keep this place clean and running smooth. Anyway - can't please everyone.
-
great stuff thanks. interested in any other approaches too, if yourself or anyone else has any
-
looks interesting. have come across the concept of view helpers before, but not really in terms of introducing entire blocks of stuff in. this might sound picky, but with Zend's way of doing things - would I be right in thinking that if I had a "widget" called in one of my templates such as: <?php echo $this->action('test', 'mycontroller'); ?> that I could invoke the same via the URL, such as: mysite.com/mycontroller/test ? couldnt that proove not so good? (I only ask this last question as I'm actually tempted to jump into ZF properly and give it a good go)
-
Hi All Consider this page: http://www.timesonline.co.uk/tol/sport/football/ I'm after a few thoughts on how some of you might actually build a dynamic page like this using an MVC-type approach. From what I've tried, I either get too much presentational code inside my controllers, or too much code inside my templates. Now - whilst I can appreciate that it's cool to put code inside templates as long as it's display logic, it's still a little messy. A simple blog listing template might go something like: <? foreach($articles as $article): ?> <div class="article"> <div class="article_inner"> <h2><?=$article['title'] ?></h2> <p><?=$article['teaser'] ?></p> </div> </div> <? endforeach ?> neat, but that just produces a single list in one column. What I'm looking for is a completely flexible layout where I can display single headlines, subheadlines, lists, related links ,etc. The way I've thought is to seperate each "block" (ie, a list, group of subheadlines, a headline, etc) into seperate block templates, which are rendered by the controller and 'appended' to the main basic newsy layout in chunks. ie: <?php // code to render headline, subheads, etc here .. .. // now build the page $tpl->append('left', $headline); // headline is the rendered headline template $tpl->append('left', $subheads); // subheads are 2/3 sub headlines displayed on single line // etc return $tpl->render(); ?> Then comes things like 'widgets' for stuff like 'most read', 'videos', etc. I'm guessing, to leave the control over whether they are/not displayed down to the designer, that these widgets would need to be rendered into individual variables for the designer to decide whether they show, rather than just appending them to mandatory content. can anyone think of any other ways I could implement a complex layout whilst still keeping flexibility for the template designer? I'm not really looking for how Drupal, Django, et al do it - and I'm not wanting to use a tempate engine of sorts, regardless of how much cleaner they might make things - just thoughts that you lot might have. Cheers Mark
-
i tend to avoid XML all together, generally out of personal preference and to keep things simple. I also have some doubts about performance when compared to using simple templates. take a look at a similar topic posted not so long back, especially at the link in Reply #4: http://www.phpfreaks.com/forums/index.php/topic,190065.0.html
-
What would be the most appropriate CMS for me?
redbullmarky replied to DRB184's topic in Miscellaneous
i'm really loving SilverStripe at the moment. It has it's issues that definitely need sorting (memory requirements/general performance, etc) but it's pretty useful for all of the above -
i'm very suspect of http://www.whois.sc i've looked up a few and they've gone within hours or days, despite never having ever being registered before. coincidence? i think not.
-
i had a tonne of fun making a top-down car racing game years ago based on a favourite old Amiga game of mine called Skidmarks. just a simple, scrolling 'map'. the fun comes getting the coding done to drive the computer's cars around the roads and around obstacles and working out who's ahead of who. depends on your reasons for making a game - ie, just for the hell of it, or learning to do it? and your experience/skill level. other ones i've attempted to emulate: - sports management game (i've done football (soccer)) - pool/snooker. this one can get mathematically juicy to work well. - worms - lemmings - Monkey Island type click and play. otherwise - i'd recommend going through a 'classic games' catalogue and picking ideas from there - eg, Spectrum/Amiga, etc. New games just don't cut it for invention and addictiveness in comparison to those of old.
-
there's a sticky for host suggestions, etc. I'm locking this one as we get a few too many 'best host' threads cheers Mark
-
there's a section in the manual for gzip here