ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Idea for an extension

May 22, 2008 10:23pm

Subscribe [2]
  • #1 / May 22, 2008 10:23pm

    Eric Snyder

    202 posts

    Having users make posts that have links in them distresses me. I know that usually domain names don’t change very often. Many users are not very savy regarding being able to edit the href code in an <a> tag. What they tend to do is browse to a page in the site, copy the link and then use the <a> tag button when they create a weblog entry. The result is a weblog entry that has a hardcoded domain name rather than a href that uses {site_url} for the domain name.

    My idea…Create an extension that would search for the exact string that is contained in the configuration setting that holds the domain name. When it finds it it replaces that text with {site_url} instead of the hardcoded domain name. This way all weblog entries that point internally get the don’t break if the domain name is changed after the entry is created. I suppose that this could be done with any string that contains the same value as the domain name in the configuration settings. <img> tags would also be handy to replace.

    Any thoughts? Are there better ways to do this?

  • #2 / May 22, 2008 10:44pm

    ms

    274 posts

    For that to work, it seems to me that only “internal” URLs would be in question? Why would you need the domain at all, then? Just remove the http://www.domain.tld or http://domain.tld completely - wouldn’t even need an extension - the replace plugin should be sufficient in that case.

    However, I really wonder if your domain will change more often that other parts of the URL, namely templategroup, template and url_title. Perhaps you’re working on a very special scenario, but I never had the need for that kind of feature 😊

    Markus

  • #3 / May 22, 2008 11:03pm

    Eric Snyder

    202 posts

    I’m curious…I always use absolute urls rather than relative urls. I wonder what others typically do. In any case when end users copy and past urls then they will be absolute.

    The downside to a plugin is that it would have to be in every template and process every time the page is loaded. The upside is that it would already be written. One could go in and add the plugin code if the scenario comes up. The extension would process only whenever a weblog entry is created or edited.

    MS you raise a good point…I may be focused on a unlikely possibility. My time may be wiser spent elsewhere. Hmmmmmm… 🙄

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases