php: using SEF url's in modules
Posted: Sun Jan 27, 2008 10:12 pm
Hi there,
first of al: I'm a total noob if it comes to php (so you know )
Now I'm building a website where users can download a lot of (self-made) songs (and their tabs, sheets, music, midi, etc.) and to prevent myself from coding the download links for every song I thought it would be easier to create a module that automatically adds the download links.
What I want to do is this:
I want to create a module which contains code which is roughly like this:
(it's going to be more complicated, but this is enough to give you an idea what I need)
Now I have my songs as Joomla articles and I want to write this code in php, so that the text "song-title" is replaced by the Alias of the article.
So for example: I have a song called "My First Joomla Experience" and I made an article with the songtext and the alias "my-first-joomla-experience" and the filename of the mp3 is "my-first-joomla-experience.mp3", thus the result of the code should be:
Also the link of this page is something like: http://www.somewebsite.com/songs/category/song-title so the Alias which I need is in the url. If I can't read the Alias, I should still be able to read the last part of the url, I guess?
Could someone briefly explain to me how I read and store the Alias from the article (if that's not done by Joomla already) and how I could write it in the code?
Thx for any help ..
ps: A link to a tutorial where I could learn exactly this would do too (I've been searching, but don't really understand what I should be searching for yet )
first of al: I'm a total noob if it comes to php (so you know )
Now I'm building a website where users can download a lot of (self-made) songs (and their tabs, sheets, music, midi, etc.) and to prevent myself from coding the download links for every song I thought it would be easier to create a module that automatically adds the download links.
What I want to do is this:
I want to create a module which contains code which is roughly like this:
Code: Select all
<a href="/download/songs/song-title/song-title.mp3">download mp3</a>
<a href="/download/songs/song-title/song-title_guitar.pdf">download tabs</a>
<a href="/download/songs/song-title/song-title_music.pdf">download music</a>
(it's going to be more complicated, but this is enough to give you an idea what I need)
Now I have my songs as Joomla articles and I want to write this code in php, so that the text "song-title" is replaced by the Alias of the article.
So for example: I have a song called "My First Joomla Experience" and I made an article with the songtext and the alias "my-first-joomla-experience" and the filename of the mp3 is "my-first-joomla-experience.mp3", thus the result of the code should be:
Code: Select all
<a href="/download/songs/my-first-joomla-experience/my-first-joomla-experience.mp3">download mp3</a>
<a href="/download/songs/my-first-joomla-experience/my-first-joomla-experience_guitar.pdf">download tabs</a>
<a href="/download/songs/my-first-joomla-experience/my-first-joomla-experience_music.pdf">download music</a>
Also the link of this page is something like: http://www.somewebsite.com/songs/category/song-title so the Alias which I need is in the url. If I can't read the Alias, I should still be able to read the last part of the url, I guess?
Could someone briefly explain to me how I read and store the Alias from the article (if that's not done by Joomla already) and how I could write it in the code?
Thx for any help ..
ps: A link to a tutorial where I could learn exactly this would do too (I've been searching, but don't really understand what I should be searching for yet )