This looks an interesting plugin, Thanks Andrés. From the user point of view, what do they see in redactor editor to access the plugin - sorry if I am being a bit slow!
Just thinking aloud: With some transformations, it should be possible to manage URL-independent internal links. So you can move or rename a page and the internal links to it are still good.
An example: Instead of the full URL, perchlinks/links.php outputs something like <a href="pid-2"/>Anchortext</a>.
When outputting the content, you have to look up all links in HTML fields and transform them via SELECT perch2_pages.pagePath WHERE perch2_pages.pageID=2, to rewrite that link as <a href="my/current/page/url">Anchortext</a> --- ahhh, doing that when rendering the page is ugly & slow
... this should be done before... but would transformation hooks (when saving and loading HTML) make sense - and would the redactor plugin permit that? I think not. I'm leaving it there :-)
I am finding that nesting isn't shown in the page listing. It looks like you intended it to (on line 14 of links.php). Do you know what to do to fix that?
Simon, thanks for reporting the issue. Here's the new link with the issue fixed (also updated the first link). I think it would be best if I create a repository for the plugin.
Urs, I know ckeditor allows (or used) to create custom html elements that could keep the page id, don't know if redactor does. Then it could be replaced using perch events when the region is saved.
@Andres: After thinking about it: if the transformation would happen in the editor, the editor-based transformation would have to run every time a link changes. But that won't be the case - at least, it should kick in at republish. So I'm sure this would have to go via PHP only.
Thanks Andrés, that's a much better way of doing it.
Andrés, thanks for the plugin!
This looks an interesting plugin, Thanks Andrés. From the user point of view, what do they see in redactor editor to access the plugin - sorry if I am being a bit slow!
In the link dialogue, you will get a select that lists existing pages
Thanks Urs, That's what I thought, but I'm not seeing it. I'll have to go back through install again I guess, no worries.
Just thinking aloud: With some transformations, it should be possible to manage URL-independent internal links. So you can move or rename a page and the internal links to it are still good.
An example: Instead of the full URL, perchlinks/links.php outputs something like <a href="pid-2"/>Anchortext</a>.
When outputting the content, you have to look up all links in HTML fields and transform them via
SELECT perch2_pages.pagePath WHERE perch2_pages.pageID=2
, to rewrite that link as <a href="my/current/page/url">Anchortext</a> --- ahhh, doing that when rendering the page is ugly & slow... this should be done before... but would transformation hooks (when saving and loading HTML) make sense - and would the redactor plugin permit that? I think not. I'm leaving it there :-)
Hi Andrés,
I am finding that nesting isn't shown in the page listing. It looks like you intended it to (on line 14 of links.php). Do you know what to do to fix that?
Thanks.
Simon, thanks for reporting the issue. Here's the new link with the issue fixed (also updated the first link). I think it would be best if I create a repository for the plugin.
Urs, I know ckeditor allows (or used) to create custom html elements that could keep the page id, don't know if redactor does. Then it could be replaced using perch events when the region is saved.
@Andres: interesting, I'll look at the redactor specs more closely. Would be cool if you'd publish a github repo, yes
@Andres: After thinking about it: if the transformation would happen in the editor, the editor-based transformation would have to run every time a link changes. But that won't be the case - at least, it should kick in at republish. So I'm sure this would have to go via PHP only.
Hi Andrés, not sure if you've put the plugin up on a repository yet, but I spotted an error.
I think line 9 of links.php
should be :
I was finding that some links weren't pointing to the proper url.