News Articles
CMS Development + Articles
| Browse in : |
All
> Topics
> CMS Development
All > Categories > Articles Any of these categories - All of these categories |
ShortURLs vs API Compliant Modules
The older, phpNuke style modules, like Downloads (and Web Links, and just about the entire core offering... still untranslated to API compliance), do not get passed through pnHTML (they call header.php and footer.php on their own, independently).
The pnHTML calls in the root index.php file used for API compliant modules include separate calls to pnHTML's functions StartPage and EndPage. These two functions then, in turn, call header.php and footer.php. However, they call them inside buffers.
Now, using ShortURLs, the header.php calls the theme function themeheader, which contains the ShortURLs buffer start. Later, the footer.php file calls the theme function themefooter, which contains the ShortURLs buffer end and translation.
Now, since the ShortURLs buffer is started inside one buffer (pnHTML StartPage), and ended inside another buffer (pnHTML EndPage), all of the information in between is not just lost but prematurely output to the browser, thus preventing ShortURL translation either way.
MirageLab now offers a revised index.php file that returns API module calls using direct calls to header.php and footer.php (the same way that older modules are called). This will make it possible to utilize ShortURLs with API compliant modules.
The revision includes standardized function.php and .htaccess files for use in making existing themes ShortURL friendly.
MirageLab recommends that sites remove any ShortURL translations that are not in use (PostCalendar, PNphpBB2, and Content Express, typically). Additionally, new translations may have to be implemented. The available templates for both functions.php (where the URLs listed are converted to simple URLs) and the .htaccess file do not typically include handlers for API compliant module pages other than the module's main function and item displays.
Some issues that may be encountered using other sources for your .htaccess and functions.php files:
The pnHTML calls in the root index.php file used for API compliant modules include separate calls to pnHTML's functions StartPage and EndPage. These two functions then, in turn, call header.php and footer.php. However, they call them inside buffers.
Now, using ShortURLs, the header.php calls the theme function themeheader, which contains the ShortURLs buffer start. Later, the footer.php file calls the theme function themefooter, which contains the ShortURLs buffer end and translation.
Now, since the ShortURLs buffer is started inside one buffer (pnHTML StartPage), and ended inside another buffer (pnHTML EndPage), all of the information in between is not just lost but prematurely output to the browser, thus preventing ShortURL translation either way.
MirageLab now offers a revised index.php file that returns API module calls using direct calls to header.php and footer.php (the same way that older modules are called). This will make it possible to utilize ShortURLs with API compliant modules.
The revision includes standardized function.php and .htaccess files for use in making existing themes ShortURL friendly.
- Download here
- ShortURLs ReadMe by Martin Stær Andersen.
- Search engine friendly URLs revisited by Karateka.
- Simple URLs by ColdRolledSteel. (sample theme)
- Theme conversion instructions in pnForums.
MirageLab recommends that sites remove any ShortURL translations that are not in use (PostCalendar, PNphpBB2, and Content Express, typically). Additionally, new translations may have to be implemented. The available templates for both functions.php (where the URLs listed are converted to simple URLs) and the .htaccess file do not typically include handlers for API compliant module pages other than the module's main function and item displays.
Some issues that may be encountered using other sources for your .htaccess and functions.php files:
- If the .htaccess file does not have a "+" before "FollowSymLinks", it can overwrite existing options, possibly preventing access to the site.
- URL not getting translated by correct handler can be caused by a shorter handler intercepting the URL first. Make sure they are ordered most to least complex.
- If no index value is found in, for example, the Topic icon link in a News article, it will not place anything for the value in the revised URL. This creates a double-dash in the revised URL. Some of the available ShortURL hacks that are available utilize ([^-]+) to capture this value in the .htaccess file. By using a "+" instead of a "*", the handler requires a value be present. In order to accomodate empty values, change the "+" to a "*" (except the last instance in each handler) in the .htaccess file.
- None of the translated URLs lead to valid pages until the .htaccess file is in place.
- Some ShortURL scripts use the extension ".html" while others use ".phtml". No known difference is made with regards to search engines, but it is important that the URLs are translated into the same extension that the .htaccess file reads.
There are no comments attached to this item.
Ratings- Options:
- View Article Map
- View Archives