Enable Pretty URLs in blocks for "Insert Link to Page"
Permalink
My front-end URLs were showing up like this: index.php?cID=123 ... even when pretty URL's were enabled.
I was having trouble getting preg_ replace_ callback to work. Does anyone else have a better (faster performance) solution for this? Or did I overlook something in the core that supports pretty URLs?
In the concrete/blocks/content/controller.php function "translateFrom" added this after line 50:
Basically, I am splitting the block text into an array, delimited by both "CCM:CID_" and the cID number. The delimiters are included in the array, and processed by the getByID function.
I was having trouble getting preg_ replace_ callback to work. Does anyone else have a better (faster performance) solution for this? Or did I overlook something in the core that supports pretty URLs?
In the concrete/blocks/content/controller.php function "translateFrom" added this after line 50:
$text_array = preg_split('/{(CCM:CID_)([0-9]+)}/i', $text, -1, PREG_SPLIT_DELIM_CAPTURE); $text_fixed = ''; $skip_next = false; foreach ( $text_array as $offset => $text_part ) { if (!$skip_next) { if ( strpos($text_part,'CCM') === 0 ) { $text_fixed .= Page::getByID($text_array[($offset+1)], false)->cPath; $skip_next = true; } else { $text_fixed .= $text_part;
Viewing 15 lines of 23 lines. View entire code block.
Basically, I am splitting the block text into an array, delimited by both "CCM:CID_" and the cID number. The delimiters are included in the array, and processed by the getByID function.
so i enabled pretty URL's , and added the on my server .htaccess file. the navigation commands have allready changed to the "pretty" versions, but unfortunately the pages have not.
i tried adding in this bit of code as well, but i'm not sure if it needs special brackets or tags?
(it's on line 56, the only thing i added is "//pretty url" so i could remember where it starts & ends)
i tried adding in this bit of code as well, but i'm not sure if it needs special brackets or tags?
(it's on line 56, the only thing i added is "//pretty url" so i could remember where it starts & ends)
http://www.concrete5.org/community/features/pretty_urls_in_content_...
My solution has the same problem as yours, it executes quite a few db calls (I'm not sure how c5's cache works, it might help though).
And no, you didn't overlook something, unless a lot of other people did too.