Nope, not getting any notices either (E_ALL) with RC3. If you still see those notices in RC3 maybe you can show me your code?
| SitePoint Sponsor |



Nope, not getting any notices either (E_ALL) with RC3. If you still see those notices in RC3 maybe you can show me your code?
Learn about the new Retro Framework
Code PHP the way it was meant to be coded!

Sorry, my mistake. It was the blog in RC1. RC3 seems to be OK.
I'm under construction | http://igstan.ro/



Great!RC3 looks pretty stable. After a few more days of testing it might come out as the first major release.
![]()
Learn about the new Retro Framework
Code PHP the way it was meant to be coded!
Hey Yam.
Remember to check out the google discussion on it. I had posted a fix for record deleting which still hasn't been fixed in the libs.
Also, the field names are still being converted to lower when trying to access a field, yet they aren't converted to lower when being stored. In other words, fields with capitals in can't be accessed with the unmodified code. I'd recommend just getting rid of the strtolower in the first place.
Jake Arkinstall
"Sometimes you don't need to reinvent the wheel;
Sometimes its enough to make that wheel more rounded"-Molona



Fixed some stuff, thanks. Implemented your delete() method and also:
$post->ID would now be set into $_values['id'] for sure. I do like it this way, because a lot of times you're unsure about the capitalization of the field, and DB's are CI in over 90% of cases, not to mention web DB cases. But it is working now, no matter how you capitalize the field!
Final release up when the website I made goes up.Very soon, maybe today or tomorrow.
Learn about the new Retro Framework
Code PHP the way it was meant to be coded!



Oh and I also replied to all your topics there with solutions!
Learn about the new Retro Framework
Code PHP the way it was meant to be coded!
Great
One other thing that has bothered me with the RC3 is that db results are now returning as objects, whereas I much prefer them as the actual values. This comes into a problem when wanting to loop through a path until you get to a single root, with ID -1. Whilst you would normally use:
now you'd have to use loose comparisons and use '-1' rather than -1 etc. Makes the loop just keep going otherwise.PHP Code:$id = 123;
$path = '';
while($id !== -1){
$row = single('topics', array('parent'=>$id));
$path = $row->name . '/' . $path;
$id = $row->id;
}
Also, the find_by_query() function now fails because it passes the result through escape - but now it's an object.
Jake Arkinstall
"Sometimes you don't need to reinvent the wheel;
Sometimes its enough to make that wheel more rounded"-Molona



Yeah, you're right. Actual values it is now.
Learn about the new Retro Framework
Code PHP the way it was meant to be coded!



Good news guys:
http://www.retro-framework.com/
It also uses the new "mod rewrite off" option.(Since my host is giving me a headache about it, I was more motivated to include this option properly)
Learn about the new Retro Framework
Code PHP the way it was meant to be coded!



1.0.1 Released with a few fixes made during development of a decent application, which you can test here:
http://www.retro-framework.com/blog/index.php/
You can also get the source in google code
http://code.google.com/p/retrophpmvc/downloads/list
Learn about the new Retro Framework
Code PHP the way it was meant to be coded!



Learn about the new Retro Framework
Code PHP the way it was meant to be coded!



1.1 is on its way! Will probably be available in 2 weeks from now. You can read a bit more about it here http://retro-framework.com/forums/index.php?topic=10.0
Learn about the new Retro Framework
Code PHP the way it was meant to be coded!




I submitted a new issue - just a minor one!![]()
Stackbox CMS - Full edit-on-page drag-and-drop CMS
Autoridge - Vehicle information & maintenance part numbers
Twitter | Blog | Online Javascript Compressor



Where?
Learn about the new Retro Framework
Code PHP the way it was meant to be coded!
http://code.google.com/p/retrophpmvc/issues/list
Btw, I'm not sure I like the big abbreviations on variable names. $request->pb won't make any sense to someone new to the code, where as $request->postback will.
Personally I can't stand functions and vars which aren't named descriptively
Jake Arkinstall
"Sometimes you don't need to reinvent the wheel;
Sometimes its enough to make that wheel more rounded"-Molona



Those are just shortcuts that are available, though, for people who do like them.
The manual, tutorials, etc, will still feature the full way to do it.
Learn about the new Retro Framework
Code PHP the way it was meant to be coded!
Will be looking forward to this framework
btw, what about a milestone?


how does your framework handle complex queries (such as with nested selects)?
for example:
Code MySQL:SELECT topics.title, topics.id as topic_id, forums.description, maxdates.maxdate as last_date, forums.id, users.username, users.id as user_id, (SELECT COUNT( topics.id ) FROM topics WHERE forum_id = maxdates.forum_id) AS topics, (SELECT COUNT( posts.id ) FROM posts, topics WHERE posts.topic_id = topics.id AND topics.forum_id = maxdates.forum_id) AS posts FROM ( SELECT posts.topic_id, topics.forum_id, posts.date AS maxdate, posts.user_id, posts.id AS post_id FROM posts INNER JOIN topics ON topics.id = posts.topic_id WHERE posts.date = (SELECT MAX( posts.date ) FROM posts WHERE posts.topic_id = topics.id ) GROUP BY topics.forum_id ) AS maxdates INNER JOIN topics ON topics.id = maxdates.topic_id RIGHT JOIN forums ON forums.id = maxdates.forum_id LEFT JOIN users ON users.id = maxdates.user_id
That's a query I use on a forums index page..
Not trying to catch you guys out, I just can't see from the tutorials how I'd rig up a query like that in Retro..![]()


Also how do you guys deal with getting data into your view layer (or your equivalent).
Say you want to print a message on screen on every page showing whether the user is logged in or not. You'd need the code for this on every page... plus page-specific code
This is actually one of the major issues I have with frameworks and website development in general. Displaying one page is easy enough but complex views always need more work.. so you could say that's what I find annoying about existing frameworks and is my suggestion to you![]()
You can run queries without the assistance of find() etc, using find_by_query(). You can use the results just like you would with find.
As for the viewing, data is sent like so:
Output:PHP Code://In the controller:
$data = array();
$data['hello'] = 'World';
render('yourpage', $data);
//in views/yourpage.tpl:
<p>
<b>Hello: </b>
<?=$hello;?>
</p>
It doesn't matter whether short tags are on or off, because it's manually parsed with preg in PHP, to allow vars i.e. $data[$n] to be used as $n.Code:<p> <b>Hello: </b> World </p>
So, with your example:
PHP Code:<?php
class UserController extends Controller{
function index($request){
$data['loggedInMessage'] = array_key_exists('user', $_SESSION) ? $_SESSION['user']->getloggedInMessage() : User::$defaultLoggedInMessage;
render("user", $data);
}
}Views/User.tpl:PHP Code:<?php
class User{
static $defaultLoggedInMessage = "You aren't logged in dufus";
private $loggedIn = false;
function login(){
$loggedIn = true;
}
function getLoggedInMessage(){
return $loggedIn ? "You are logged in!" : self::$defaultLoggedInMessage;
}
}
PHP Code:<h1>A Message</h1>
<p>We have a message for you!</p>
<p><?=$loggedInMessage;?></p>
Jake Arkinstall
"Sometimes you don't need to reinvent the wheel;
Sometimes its enough to make that wheel more rounded"-Molona


Yeah, I read about the query thing earlier on, oooops.
For the view, you're missing my point I think. Consider for example a page belonging to the forum part of a website, say the index page of the forums. This page obviously has to load and display a list of forums and number of posts, topics blah blah blah.
This forums page is part of a larger page which may include other PHP-generated elements such as that loginbox.
The thing is, you have described the usage of the UserController (which is exactly how I do it too) to retrieve the login info, yet you'd need a ForumController to retrieve and display the list of forums. So two controllers and potentially more on one page.. how do you handle that?
Ok, I see what you mean.
Well, a view can be inserted into another simple by:
Now, echoing $message in message2.tpl will insert the output of the initial render of message.tpl.PHP Code:$firstpage['message'] = "hello world";
$secondpage['message'] = _render('message', $firstpage);
render('message2', $secondpage);
I see what you mean with the multiple controller idea though.
Currently the way to acheive that would be to have a static method returning _render() of the template, and that can be saved to var in $data, for example:
PHP Code:class User{
static function UserArea(){
if(array_key_exists('user', $_SESSION)){
$data['message'] = 'Logged in as '.session('user')->UserName;
return _render('userMessage', $data);
}
return _render('loginForm');
}
}
PHP Code:$data['login'] = User::UserArea();
render('somepage', $data);
PHP Code:<div id="user">
<?=$login?>
</div>
Jake Arkinstall
"Sometimes you don't need to reinvent the wheel;
Sometimes its enough to make that wheel more rounded"-Molona


okay, and you'd repeat the calling of that static method in every page you'd use it in?
for example:
Code PHP:$data['login'] = User::UserArea(); $data['somepage'] = $this->getStuff(); render('somepage', $data); //or $data['login'] = User::UserArea(); $data['some_specific_page'] = $this->getStuff(); render('some_specific_page', $data); //or $data['login'] = User::UserArea(); $data['some_other_page'] = $this->getStuff(); render('some_other_page', $data);
edit: just to say, those three examples would be in three seperate controller methods..
Last edited by old_iron; Oct 21, 2008 at 04:32.


I haven't used this framework, but I'd imagine you could use something like this...
PHP Code:class UserPage extends Controller {
function render($tpl, $data) {
$data['login'] = User::UserArea();
render($tpl, $data);
}
}
class SpecificUserPage extends UserPage {
function index($request) {
$this->render('someOtherPage', array(
'someVar' => $this->getSomeStuff()
));
}
}


Bookmarks