We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24719
    • 194 Posts
    hi,

    i’m creating a property site. my clients want to be able to enter a web address to see all properties posted by a certain landlord, e.g. http://www.theirpropertysite.com/landlord1 would list all properties by landlord1.

    The way I thought of to do this is to have a plugin that is called on the system event ’OnPageNotFound’. If a page doesn’t exist, it will invoke the plugin that will check to see if the end of the address matches a landlord’s username. If it does, it will output a list of their properties.

    I’ve done all of this. However, as a plugin, it can either return the raw HTML for the property list (by echoing the list and then calling ’exit’), or if it returns, the user is just redirected to the error page. I can’t dynamically generate content for a page that doesn’t exist.

    I tried putting a snippet on the error page instead of using a plugin. This worked fine, except that it would have been sending 404s even when landlord pages exist - not very good optimisation.

    Is there an event I could use for a plugin that would let me insert my own content that could then be inserted into the main site template, even though the actual page doesn’t exist? Or would my only option be to go back to putting a snippet on the error page, and hacking the core to conditionally send a 404?

    Thanks in advance...