Tech Journal
Latest Entries
- Custom code based on image sizes in ExpressionEngine
- Mining date-based ExpressionEngine URLs
- Preselecting Pulldowns in ExpressionEngine Standalone Edit Forms
Tech and Design
- My Favorite New Things From 2009
- Five Things I’ve learned About Freelancing
- Interesting Data Visualization
- Hydrogen Car Design to be Released “Open Source”
- Chicago Design Archive
- Keynote ‘09 - “View Package Contents”
iPhone
- iPad is more than just an e-Reader
- iPhone App Showcases Hi-Def Holographic Recordings
- iPhone as Digital Swiss Army Knife
Web
- Skipping the Multi-entry Page in ExpressionEngine
- Opera Unite
- Assigning movie clips levels in Actionscript 3.0
- Opening Shadowbox windows from a link in Flash
- Passing FLV file paths to an AS 3.0 SWF with SWFobject
Motion
Mining date-based ExpressionEngine URLs
August 12, 2011
For a calendar project I’m working on, I ran into the need to create an ExpressionEngine readable date from URL segments.
My segments are set up as follows:
www.mysite.com/templateName/cateogory/YYYY/MM/DD
In order to format the URL into a date ExpressionEngine understands, I set PHP to “output” and created a PHP variable using the segment variable feature of EE to reformat:
<?php
$mydatebegins = "{segment_4}-{segment_5}-{segment_6} 00:00";
?>
We can stop there, and we have a date you can use in the Channel Module to filter entries. What I needed, however, was a string to use in the Query Module to query the database and find entries based on the date in the URL.
I then echo this as a string using PHP strtotime, as follows, as an embedded template variable:
{embed="myembeds/myTemplate" startDate="<?php echo date( strtotime($mydatebegins));?>"}
So, this little technique didn’t take long, and sent me on my way to creating my own calendar with a little more flexibility than what the default ExpressionEngine dynamic url behaviors provide.

Leave a Comment