Permalink Disappointment

By Dave - February 28, 2013

Hi Perch,

We almost always release a few minor upgrades after a 1.00 plugin release to address user requests and real-world server environments.  So 1.00 users often get extra support and customization, and hopefully we'll be able to do that for you as well.

We've already got query-string support on the list of things to revisit for manual permalinks.  Ideally we want everything to be as automatic as possible, though.

In your example, is record 4 always associated with category 2?  Or is the navigation of your site such that there are multiple views possible for the details of record 4?  And if record 4 is always associated with category 2, is it possible to load 4's category if it's not defined?  Put another way, is it possible to programmatically determine what the url for a record would be?

If you can make a a short list of what is working well, what you like, and what isn't working well, what you don't like, and what you wish it did, I can start thinking about some updates or suggestions.  

Hope that helps, 

PS:  We're moving our office today, so might be offline for a short bit while our internet and phones get transferred.

Dave Edis - Senior Developer
interactivetools.com

By Perchpole - March 3, 2013

Hi, Dave -

Hope the move is going well!

In response to your questions to my example (above), record 4 would always be associated with category 2. However, it would not be possible to load the category without the query string. This is important because the category determines the template (and other elements) used for  the record page.

:0)

Perch

By Dave - March 11, 2013

Hi Perch,

I'm going to see if I can add support for custom query strings for manually created permalinks.

However, about your example custom URLs: www.mysite.com/index.php?cat=2&rec=4

It might be easier if the viewer could automatically determine the category.  What if we just used this url: www.mysite.com/index.php?rec=4

And then we added a line of code to the top of the script to automatically load the category number from the record number?  Like this: 

$_REQUEST['cat'] = array_value( mysql_get('articles', @$_REQUEST['rec'] ), 'cat');

Note: That example code assumes your tablename is named 'articles', has a field named 'cat' and 'rec' refers to the 'num' field.

Or if you're already loading the article record you can set $_REQUEST['cat'] with that value.

Sometimes we "fake" request values to make lookups like this easier, or to make the urls look cleaner.  For example, I was working on a search form this morning and instead of the standard list of fields: 

<input type="text" name="title,tags,category,content_query" value="<?php echo htmlencode(@$_REQUEST['title,tags,category,content_query']); ?>" size="20"/>

I just used 'k' (for keyword): 

<input type="text" name="k" value="<?php echo htmlencode(@$_REQUEST['k']); ?>" size="20"/>

And then added this line to to the top of the script:

// fake query strings for nicer urls
if (@$_REQUEST['k']) { $_REQUEST['title,tags,category,content_query'] = $_REQUEST['k']; }

Let me know if you think there's a way we can get the category number dynamically instead of specifying it in the url.  If we can do that we can use the standard Permalinks functionality and it should all be pretty automatic.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com