single URL handle, multiple data sources (exclusive as in XOR)
This is an open discussion with 5 replies, filed under General.
Search
I haven't tested it, but I imagine you can do something very similar to the .htaccess
rules.
Symphony has the following rules in it's .htaccess
file.
### FRONTEND REWRITE - Will ignore files and folders RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*/?)$ index.php?symphony-page=$1&%{QUERY_STRING} [L]
You could always inject your custom rewrite rules before this logic and instead change the $1
to represent your page.
For instance
RewriteRule ^blog/([0-9]+)/?$ index.php?symphony-page=blog/page&%{QUERY_STRING} [L] RewriteRule ^blog/([a-zA-Z0-9]+)/?$ index.php?symphony-page=blog/read&%{QUERY_STRING} [L]
I'm not 100% sure that exact syntax will work, but it'd be close!
You should separate these into separate Symphony pages, but mask them with rewrite rules. Instead of customising your .htaccess you could use the URL Router extension.
As Nick suggested, you could simply make 3 pages to show the content: one parent and 2 childs:
Parent = Blog
Child 1 = List
with parameter $page
Child 2 = Entry
or Title
or Post
or whatever and parameter $entry-title
List Page = www.site.com/blog/list/{$page}
Entry details Page = www.site.com/blog/entry/{$entry-title}
Thanks! I'll give that extension a try.
Or you can keep single URL and use Filter field to turn datasources "on" and "off" depending on parameters passed in URL (so "blog" would list latest blog entries, and "blog/selectedDate" would show just entries matching $selectedDate
, and "blog/selectedDate/selectedEntry" would show $selectedEntry
:).
Create an account or sign in to comment.
I'm building a personal website and hoping to learn some things along the way. One thing I haven't been able to figure out is how to make a single URL handle process different data sources.
i.e.:
I want a blog, and i want the 'blog' handle to show me either the archive or a single entry depending on the parameters.
www.site.com/blog/{$page} -> show a list of blog entries, paginated. Something like an archive or index.
www.site.com/blog/{$entry-title} -> show the requested blog entry.
I was looking at bauhouse's ensemble (I haven't installed it though) and from what I see in this XSL and this SQL statement
it seems that he's pulling all entries even when he's only displaying one, which translates to unnecessary MySQL load.
If this helps somehow, I'd like to do something similar to the following rewrite rules if instead of symphony I was using an imaginary blog.php script: