Parsing strange v4

  • Published on
    01-Sep-2014

  • View
    2.175

  • Download
    0

Embed Size (px)

DESCRIPTION

 

Transcript

<ul><li> Parsing Strange:URL to SQL to HTML<br />Hal Stern<br />snowmanonfire.comslideshare.net/freeholdhal<br />headshot by Richard Stevenshttp://dieselsweeties.com<br /></li> <li> Why Do You Care?<br />Database performance = user experience<br />A little database expertise goes a long way<br />Taxonomies for more than sidebar lists<br />Custom post types<br />WordPress as a powerful CMS &gt;&gt; blog<br />Change default behaviors<br />Defy the common wisdom<br />Integrate other content sources/filters<br />WordCamp Philly 2010<br />2<br /></li> <li> Flow of Control<br />Web server URL manipulation<br />Real file or permalink URL?<br />URL to query variables<br />What to display? Tag? Post? Category?<br />Query variables to SQL generation<br />How exactly to get that content?<br />Template file selection<br />How will content be displayed?<br />Content manipulation<br />3<br />WordCamp Philly 2010<br /></li> <li> Whose File Is This?<br />User URL request passed to web server<br />Web server checks.htaccessfile<br />WP install root <br />Other .htaccessfiles may interfere<br />Basic rewriting rules:If file or directory URL doesnt exist, start WordPress via index.php<br />WordCamp Philly 2010<br />4<br /><br />RewriteEngine On<br />RewriteBase /whereyouputWordPress/<br />RewriteCond %{REQUEST_FILENAME} !-f<br />RewriteCond %{REQUEST_FILENAME} !-d<br />RewriteRule . /index.php [L]<br /><br /></li> <li> Example Meta Fail: 404 Not Found<br />Access broken image URLs for unintended results: no 404 pages!myblog/images/not-a-pic.jpg<br />Web server cant find file, assumes its a permalink, hands to WP <br />WP cant interpret it, so defaults to home<br />WordCamp Philly 2010<br />5<br />myblog/<br />myblog/wp-content (etc)<br />myblog/images<br /></li> <li> What Happens Before The Loop<br />Parse URL into a query<br />Set conditionals &amp; select templates<br />Execute the query &amp; cache results<br />Run the Loop:<br />WordCamp Philly 2010<br />6<br /></li> <li> Examining the Query String<br />SQL passed to MySQL in WP_Query objects request element<br />Brute force: edit theme footer.phpto see main loops query for displayed page<br />WordCamp Philly 2010<br />7<br /></li></ul>