Learning some new tricks

I've been taking the last week to work on a personal project from home, think it's probably one of the best vacations I've taken, even though I'm not going anywhere.  Read more to find out what I have been working on, and a couple new tricks that I learned.

The new project may or may not be news to my readers, it probably depends on if you keep up with my facebook and twitter streams or not.  Basically, I'm trying to start a new movement of people doing 'bikedates' all around the metro.  

You can check it out here:


The real meat of the project lives on the group rides page.  I am using the same blocks that I was trying to do the upgrade to my blog here, but I moved some of the code around.  Where in the original file the blocks were sending their requests to a tools file, I moved things around to be coded against the page object that the block lives on, then put the filtering code into a page controller function.  It works really well, and all of the limitations I was running into with not having a fully instantiated c5 install is gotten around.  So I can do things like call areas off of my page lists and output them with new templates.  This is how I get the display of the group rides that you can filter.  If I was just using the block as is from the marketplace, all I would be able to output in the list would be the description of the page and any page attributes, which really isn't enough.

The other thing that I've really been working with is how to interact with page attributes.  I have known the basics of how to do this, but I didn't really know how to set them up to use in forms.  So I made a form for adding new group rides that's almost all page attriubutes, then I use the saveAttributeForm($c) method and it all just works.  I was able to take the same idea and put it into effect on the actual group rides as well - normally all of the metadata forms live inside of a drop-down panel.  So you have to click "Page Properties > Custom Attributes" to edit any of the attributes.  This isn't something most people can be expected to know, so what I did was move the attribute forms into the sidebar of the page in edit mode.  Then you can hit a save button and submit back to the page controller again and update the metadata.  It seems to work really well and makes the page much more accessible for people that aren't familiar with the concrete 5 editing interface.

Those two things basically just ramped up what I'm able to do for page interactivity, and how quickly I can do it.  I feel much more confident in my abilities to program very complicated page applications in the concrete 5 api.

I also found out about this really cool thing you can do in php, for string output.  I'm often building a string of custom css or js that needs to be formatted by php, and it can be rather complicated to keep all of the strings working together, making sure your quotes are properly nested and your dots are all in the right place.  Basically it kind of sucks.

Turns out you can just do this:

$html .=<<<EOS

<preformatted html with {$variables} here>


And it keeps all the formatting.  I'm sure I'm probably going to use this quite a bit in the future, too.  I'm sure if I was someone who'd gone to school for this kind of stuff that would be something they teach you in the first sememester of basic php, but sometimes the simple little things like that I don't know just simply because I'm all self-taught.  When I find things like that, though, I'm usually happy, and hope that I remember them and implement them.  

I guess that's the reason for blogging it - you never know who else might be in the same boat and be like "aha, that's exactly what I needed!"

blog comments powered by Disqus