MODx Community Forums
The MODx Blog
Donations
Feedburner Feeds
Documentation
Bugs & Requests
The Wiki
download MODx
plugins, modules, snippets
online demo
Nov 20, 2008, 05:38 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search via SMF
or Google:
modx forums
all of modxcms.com
web
MODxCMS.com
Forums
Help
Login
Register
News
:Read
Frequently Asked Questions (FAQ)
MODx Community Forums
»
Support
»
General Support
(Moderators:
zi
,
PaulGregory
)
»
Different exteniosn with friendly URLS?
Pages: [
1
]
Go Down
« Previous topic
Next topic »
Print
Author
Topic: Different exteniosn with friendly URLS? (Read 2691 times)
0 Members and 1 Guest are viewing this topic.
Briggsy
Sr. Member
Posts: 372
Different exteniosn with friendly URLS?
«
on:
Dec 30, 2005, 05:11 AM »
Is there any one to change the extension of a single link when using friendly URLS and add extensins?
I have one link I want to end in XML. I tried to give it an alias of .XML but it added .HTML to the end of it so it now reads DOCUMENT.XML.HTML
Logged
Emergency Management Academy of New Zealand
http://www.emanz.ac.nz
MODx Sandbox
Login: sandbox Password: castle
Admin Sandbox
Login: sandbox Password: castle
xwisdom
Foundation
Posts: 1,732
Re: Different exteniosn with friendly URLS?
«
Reply #1 on:
Dec 30, 2005, 11:01 AM »
Here's a quick fix for $modx->makeUrl to not appy .html suffix to aliases with an extension (e.g. .xml, .pdf, etc)
I have not tested it but I think it should work.
Code:
function makeUrl($id, $alias='', $args='') {
$url= '';
$virtualDir= '';
if(!is_numeric($id)) {
$this->messageQuit('`'.$id.'` is not numeric and may not be passed to makeUrl()');
}
if($args!='' && $this->config['friendly_urls']==1) {
// add ? to $args if missing
$c = substr($args,0,1);
if ($c=='&') $args = '?'.substr($args,1);
elseif ($c!='?') $args = '?'.$args;
}
elseif($args!='') {
// add & to $args if missing
$c = substr($args,0,1);
if ($c=='?') $args = '&'.substr($args,1);
elseif ($c!='&') $args = '&'.$args;
}
if($this->config['friendly_urls']==1) {
if($alias!='') {
$url= $this->config['friendly_url_prefix'].$alias;
} elseif($alias=='') {
$alias = $id;
if($this->config['friendly_alias_urls']==1) {
$al = $this->aliasListing[$id];
$alPath = !empty($al['path'])? $al['path'] . '/': '';
if($al && $al['alias']) $alias = $al['alias'];
}
$alias = $alPath . $this->config['friendly_url_prefix'].$alias.$suffix;
$url = $alias;
}
$pa = pathinfo($url); // get path info array
$suffix = !empty($pa[extension]) ? '':$this->config['friendly_url_suffix'];
$url.= $suffix.$args; // apply suffix and arguments
}
else {
$url= 'index.php?id='.$id.$args;
}
return $this->config['base_url'] . $virtualDir . $url;
}
Logged
xWisdom
www.xwisdomhtml.com
The fear of the Lord is the beginning of wisdom:
MODx Co-Founder
- Create and do more with less.
Briggsy
Sr. Member
Posts: 372
Re: Different exteniosn with friendly URLS?
«
Reply #2 on:
Dec 30, 2005, 04:36 PM »
I replaced the original code in document.parser.class.inc.php with the one above, but it doesn't seem to work. Still appending .html
Any other ideas as this is way over my head?
[EDIT]
When I compare what was in the original file and the code above, they are the same.... did you cut n paste the wrong bit?
«
Last Edit: Dec 30, 2005, 05:05 PM by briggsys
»
Logged
Emergency Management Academy of New Zealand
http://www.emanz.ac.nz
MODx Sandbox
Login: sandbox Password: castle
Admin Sandbox
Login: sandbox Password: castle
xwisdom
Foundation
Posts: 1,732
Re: Different exteniosn with friendly URLS?
«
Reply #3 on:
Jan 01, 2006, 10:32 AM »
Hmmm,
That's odd they can't be the same.
See here:
Code:
if($this->config['friendly_urls']==1) {
if($alias!='') {
$url= $this->config['friendly_url_prefix'].$alias;
} elseif($alias=='') {
$alias = $id;
if($this->config['friendly_alias_urls']==1) {
$al = $this->aliasListing[$id];
$alPath = !empty($al['path'])? $al['path'] . '/': '';
if($al && $al['alias']) $alias = $al['alias'];
}
$alias = $alPath . $this->config['friendly_url_prefix'].$alias.$suffix;
$url = $alias;
}
$pa = pathinfo($url); // get path info array
$suffix = !empty($pa[extension]) ? '':$this->config['friendly_url_suffix'];
$url.= $suffix.$args; // apply suffix and arguments
}
else {
$url= 'index.php?id='.$id.$args;
}
Logged
xWisdom
www.xwisdomhtml.com
The fear of the Lord is the beginning of wisdom:
MODx Co-Founder
- Create and do more with less.
Briggsy
Sr. Member
Posts: 372
Re: Different exteniosn with friendly URLS?
«
Reply #4 on:
Jan 01, 2006, 04:32 PM »
Must have screwed up my copy and paste as I used Winmerge to compare files and it said they were the same. However re done it with my own eyes, and yup they are different... sorry
This however didn't seem to make a difference, the link still has .html appended, so it now has rssfeed.xml.html even though the alias in rssfeed.xml. If I change the alias it, the new one still has .html appended
If I type in the url
http://www.emanz.ac.nz/rssfeed.xml
, I get the document, I also get it if I add .html to that.
Logged
Emergency Management Academy of New Zealand
http://www.emanz.ac.nz
MODx Sandbox
Login: sandbox Password: castle
Admin Sandbox
Login: sandbox Password: castle
eastbind
Sr. Member
Posts: 253
This ideograph means LOVE! I love MODx.
Re: Different exteniosn with friendly URLS?
«
Reply #5 on:
Jan 18, 2006, 08:00 AM »
I have troubled with the same problem, too.
I show my solution.
As well as the mod mentioned above, I add the followings.
in document.parser.class.inc.php
Code:
function makeFriendlyURL($pre,$suff,$alias) {
// Modified for .xml extension 2006/1/18
$dir = dirname($alias);
$painfo = pathinfo($alias);
$tmpsuffix = !empty($painfo[extension]) ? '':$suff;
return ($dir!='.' ? "$dir/":"").$pre.basename($alias).$tmpsuffix;
//
return ($dir!='.' ? "$dir/":"").$pre.basename($alias).$suff;
}
And, for Export, in export_site.static.action.php
Code:
//
$filename = !empty($alias) ? $prefix.$alias.$suffix : $prefix.$id.$suffix ;
if(empty($alias)) {
$filename = $prefix.$id.$suffix;
}
else {
$painfo = pathinfo($alias);
$tmpsuffix = !empty($painfo[extension]) ? '':$suffix;
$filename = $prefix.$alias.$tmpsuffix;
}
It seems to be working properly.
Logged
Pages: [
1
]
Go Up
Print
« Previous topic
Next topic »
Jump to:
Please select a destination:
-----------------------------
Announcements
-----------------------------
=> Important News
=> Security Notices
-----------------------------
Commercial Support
-----------------------------
=> [CS] About Commercial Support
-----------------------------
Development & Coding
-----------------------------
=> Commercial Inquiries & Bounties
=> Core Code
===> MODx Next
===> xPDO
=> Module, Plugin & Snippet Creation and Modification
=> In Development
=> Templates
=> Internationalization
===> Bulgarian
===> Chinese
===> Czech
===> Dutch
===> French
===> German
===> Irish
===> Italian
===> Japanese
===> Polish
===> Portuguese
===> Russian
===> Slovak
===> Spanish
===> Swedish
===> Persian - فارسي
-----------------------------
Support
-----------------------------
=> Release Support
===> 0.9.6.2
===> 0.9.6.1
===> 0.9.6
===> 0.9.5 and earlier
=> General Support
===> MODx 101
===> E-Commerce, E-Marketing, Analytics & SEO
===> Hosting Experiences
===> IIS / Windows Hosting Issues
=> Documentation, Tips & Tricks
===> Documentation Suggestions & Corrections
-----------------------------
Add-ons, Extensions & Elements
-----------------------------
=> Module, Plugin & Snippet Usage
=> General Repository Items Support
=> Navigation & Tagging/Taxonomy
===> Wayfinder & DropMenu
=> Creating & Repurposing Content
===> Ditto
===> Jot
===> QuickEdit
=> Users, Authentication & Personalization
===> WebloginPE
===> WebLogin, WebSignup and WebChangePwd
=> Rich Text Editors & File Browser
===> TinyMCE
===> FCKeditor
===> MCPuck File Browser
=> Forms, Form Processing & Anti-Spam
===> eForm
=> Search
===> AjaxSearch
=> E-business
=> Polls, Calendars, Address Book and Community
=> Third-party integrations
=> Images, Videos & Podcasts
===> MaxiGallery
=> Manager, Parser & the Core
===> Backup & Versioning
===> Doc Finder
===> ManagerManager
===> PHx
=> Templates
-----------------------------
General Discussions
-----------------------------
=> General MODx Discussions
=> Web Design and Development
=> Wishlist
=> You and Your Sites
=> modxcms.com Discussions and Suggestions
=> Off-topic
-----------------------------
Czech Community
-----------------------------
=> Oznámení
===> Důležitá oznámení/novinky
===> Bezpečnost
=> Podpora
===> FAQ (často kladené otázky)
===> Instalace
===> Moduly, pluginy, "snippets & code" (šablony zdrojových kódů)
===> Design & Šablony
=> Dokumentace, tutoriály (návody) a překlady
===> Dokumentace
===> Tutoriály (návody)
===> Překlady (lokalizace)
=> Komunita
===> Oznámení
===> Představte se, prosím
===> Ukázky práce
===> Různé aneb cokoli co se jinam nehodí
-----------------------------
Bulgarian Community
-----------------------------
=> Поддръжка
===> Често задавани въпроси
===> Инсталация
===> Модули, Плъгини, Снипети и код
===> Дизайн и Шаблони
=> Документация, Ръководства и Превод
===> Документация
===> Ръководства
===> Превод
=> Общество
===> Съобщения
===> Представете се
===> Представете сайта си
===> Дискусии извън MODx
-----------------------------
Dutch Community
-----------------------------
=> Ondersteuning
===> Veel gestelde vragen
===> Modules, Plugins, Snippets & Code
===> Design & Templates
=> Documentatie, Tutorials en Vertalingen
===> Documentatie
===> Tutorials
===> Vertalingen
=> Community
===> Aankondigingen
===> Stel jezelf voor
===> Site Showcase
===> De stamkroeg
-----------------------------
Finnish Community
-----------------------------
=> Tuki
===> UKK
===> Asennus
===> Moduulit, liitännäiset, koodinpätkät
===> Ulkoasu/Sivustopohjat
=> Dokumentaatio, oppaat ja käännökset
===> Dokumentaatio
===> Käännökset
===> Oppaat
=> Yhteisö
===> Tiedotteet
===> Esittele itsesi
===> MODx sivustosi
===> Kahvihuone
-----------------------------
Filipino Community
-----------------------------
=> Suporta
===> Kadalasang tanong
===> Instalasyon
===> Moduler, Maidadagdag, Karagdagang mga Code
===> Desenyo at Templates
=> Dokumentasyon, Mga Turo, Mga Salin
===> Dokumentasyon
===> Mga Turo
===> Mga Salin
=> Kumunidad
===> Anunsyo
===> Ipakilala ang sarili
===> Ang Galing ng pinoy
===> Tsismisan atbp
-----------------------------
French Community
-----------------------------
=> Support
===> FAQ
===> Installation
===> Module, plugin, snippets
===> Design/Templates
=> Documentation, Tutoriels et Traductions
===> Documentation
===> Traduction
===> Tutoriels
=> Communauté
===> Annonces
===> Présentez vous
===> Vos sites
===> Le Bistrot Français
-----------------------------
German Community
-----------------------------
=> Support (de)
===> FAQ (de)
===> Installation (de)
===> Module, Plugins, Snippets & Code (de)
===> Design & Templates (de)
=> Dokumentation, Tutorials und Übersetzung
===> Dokumentation
===> Tutorials (de)
===> Übersetzung
=> Community (de)
===> Ankündigungen
===> Stellt Euch vor
===> Beispielseiten
===> Off Topic / Verschiedenes
-----------------------------
Irish Community
-----------------------------
=> Tacaíocht
===> CC Ceisteanna Coitianta
===> Breiseáin (cláir bhreise), Snippets & Comhaid
===> Suiteáil
===> Dearadh & Teimpléid
=> Doiciméid, Teagascóireacht agus Aistriúchán
===> Doiciméadú
===> Teagascóireacht
===> Aistriúchán
=> Pobal
===> Fógraí
===> Cuir Tú Féin in Aithne
===> Gailearaí an Láithreáin
===> Caifé / An Tábhairne / Ábhar Cainte Eile / Ilghnéitheach
-----------------------------
Italian Community
-----------------------------
=> Supporto
===> FAQ
===> Installazione
===> Moduli, Plugin, Snippet e altro codice
===> Web Design e Template
=> Documentazione, Tutorial e Traduzione
===> Documentazione
===> Tutorial
===> Traduzione
=> Comunità
===> Annunci
===> Presentazioni
===> Siti in vetrina
===> Chiacchiere in libertà
-----------------------------
Japanese Community
-----------------------------
=> サポート
===> 良くある質問
===> インストール
===> モジュール・プラグイン・スニペット・本体
===> デザインやテンプレート
=> マニュアル・テュートリアル・翻訳
===> マニュアル
===> 事例集、テュートリアル
===> 日本語化
=> コミュニティ
===> お知らせ
===> MODxサイト展示場
===> 自己紹介
===> 雑談
===> 国産リソース
-----------------------------
Persian Community
-----------------------------
=> پشتيباني
===> راهنما
===> نصب
===> ماژول , پلاگین ها , کد ها و جزییات
===> طراحی و قالب ها
=> مستند سازی , آموزش ها و ترجمه ها
===> مستند سازی
===> آموزش ها
===> ترجمه ها
=> انجمن ها
===> اخبار
===> معرفی کردن خود
===> نمایش دادن سایت ها
===> بحث های عمومی و سایر موضوعات
-----------------------------
Polish Community
-----------------------------
=> Wsparcie
===> FAQ
===> Instalacja
===> Moduły, pluginy, snipety i kod
===> Wygląd i szablony
=> Dokumentacja, tutoriale i tłumaczenie
===> Dokumentacja
===> Tutoriale
===> Tłumaczenie
=> Społeczność
===> Ogłoszenia
===> Przedstaw się
===> Twój serwis WWW
===> Hyde Park
-----------------------------
Portuguese Community
-----------------------------
=> Suporte
===> FAQ - Dúvidas Frequentes
===> Instalação
===> Módulos, Plugins, Snippets e Código
===> Design e Templates
=> Documentação, Guias e Traduções
===> Documentação
===> Guias
===> Traduções
=> Comunidade
===> Anúncios
===> Apresente-se!
===> Bar da esquina (fora de tópico)
===> Portfólio de Sites
-----------------------------
Russian Community
-----------------------------
=> Поддержка
===> ЧАВО (FAQ)
===> Установка
===> Модули, плагины, сниппеты и код
===> Дизайны и шаблоны
=> Документация, Уроки, Перевод
===> Документация
===> Уроки
===> Перевод
=> Сообщество
===> Объявления
===> Представьтесь публике
===> Галерея сайтов
===> Диван
-----------------------------
Scandinavian Community
-----------------------------
=> Support
===> Frågor och svar
===> Installation
===> Moduler, plugins, snippets och kod
===> Design & sidmallar
=> Dokumentation, guider och översättningar
===> Dokumentation
===> Guider
===> Översättningar
=> Webbgemenskap
===> Meddelanden
===> Presentera dig själv
===> Visa upp dina webbsidor
===> Ordet fritt
-----------------------------
Spanish Community
-----------------------------
=> Soporte
===> FAQ
===> Instalación
===> Modulos, Plugins, Snippets & Código
===> Diseño y plantillas
=> Documentación, Tutoriales y Traducciones
===> Documentatción
===> Tutoriales
===> Traducciones
=> Comunidad
===> Anuncios
===> Presentaciones personales
===> Muestra de sitios
===> El Café
-----------------------------
TÜRKÇE (Turkish)
-----------------------------
=> Destek
===> SSS
===> Kurulum
===> Modüller, Pluginler, Snippetlar & Kodlar
===> Dizayn & Temalar
=> Belgeleme, Eğitmenler ve Çeviri
===> Belgeleme
===> Eğitmenler
===> Çeviri
=> Topluluk
===> Duyurular
===> Kendinizi Tanıtın
===> Site Vitrini
===> Konu Dışı