× Here you can get community support related to ReDJ.

How to get the page name?

  • marcel555
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
10 years 2 months ago - 10 years 2 months ago #2126 by marcel555
How to get the page name? was created by marcel555
Hello,

I have an issue here which causes my brain to have a "buffer overflow" :lol: # It sounds simple, but yet it's a hard nut for me.

I need to get just the page name of the current url. For example I would like to redirect
from /aa/bb/cc/1-article.html
to /cat/1-article.html

The original path could also be /aa/bb or /aa/bb/cc/dd -> whatever, I only need to get the last part "1-article.html".

I think it is similar to this issue: www.selfget.com/forum/redj/387-a-challenging-redirect.html#729 - but this guy had always 3 path level, which doesn't work for me.

I also tried it with the tableselect macro and requestvar (fetch the id from the url and then the alias from the database). But the id in my Joomla installation is not just a number, but for example "2:alias".

Oh, I use Joomla 2.5.18 and ReDJ 1.7.2 Enterprise.


Thank you for any hint
Marcel

By the way: There are many macros concerning the path, like pathltrim and so on. Perhaps there could also be a macro which returns the page name?
Last edit: 10 years 2 months ago by marcel555.

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #2130 by admin
Replied by admin on topic How to get the page name?
Hi Marcel,
I have no tested, but this should work (if not, let me know):
{preg_match 1}/\/([^\/]+\.html)$/i{/preg_match} => 1-article.html

Return the "page name" could be a good idea if you mean "the last piece" where path is:
/piece/piece/piece/lastpiece

But this can be always accomplished with a simple regular expression :)

Kind regards,
Luigi
The following user(s) said Thank You: marcel555

Please Log in or Create an account to join the conversation.

  • marcel555
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
10 years 2 months ago #2136 by marcel555
Replied by marcel555 on topic How to get the page name?
Hi Luigi,

your approach worked immediately. Thank you!

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #2137 by admin
Replied by admin on topic How to get the page name?
Great! :)

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

Time to create page: 0.097 seconds