Home Forum
2024-05-02
Benvenuto, Ospite
Nome Utente Password: Ricordami

chapter shortcut?
(1 Online) (1) Ospite
  • Pagina:
  • 1

ARGOMENTO: chapter shortcut?

chapter shortcut? 12 Anni, 3 Mesi fa #2965

I'm working on the following:

For a website (teaching material for learning Italian!) I need to create some sort of shortcut macro.

www.abcde.com/3.23 (3.23 is the chapter of the book)

should be redirected to

www.abcde.com/cms/index.php/inhalte/item/3-23

i.e. the dot in the number must be replaced with "-" and "cms/index.php/inhalte/item/" in front of the number. Is this possible with a macro? Single entries work well but I suppose there is a better way than making several hundred redirects.
I've tried a lot but didn't succeed at all.

thanks a lot for your help.



(and last but not least: great component, WOW!)
Ultima modifica: 12 Anni, 3 Mesi fa Da hoppingmad.
L'Argomento è stato bloccato.

Re: chapter shortcut? 12 Anni, 3 Mesi fa #2967

  • admin
  • Offline
  • Administrator
  • Messaggi: 1603
Thanks,
a rule for this will be very easy to create in the next version with support for "placeholders".

Meanwhile, we can get result also with current version:

From URL: ^/[0-9]{1,2}\.[0-9]{1,2}$


With this regexp you will match all "chapters" in the form /xx.xx. Now we should build the destination. We can use the preg_match macro, but is available only for Enterprise version:

To URL: http://{siteurl}/cms/index.php/inhalte/item/{preg_match 1}/\/([0-9]{1,2})\.([0-9]{1,2})$/{preg_match}-{preg_match 2}/\/([0-9]{1,2})\.([0-9]{1,2})$/{preg_match}


Using the internale redirect (another Enterprise feature) you can hide the destination URL from the web browser.

Best regards,
Luigi
L'Argomento è stato bloccato.
Ringraziano per il messaggio: hoppingmad

Re: chapter shortcut? 12 Anni, 3 Mesi fa #2970

Great! Finally got it. Suppose the closing slash for the preg_match were lost in space. With those /preg_match it works fine. Thanks a lot!
{preg_match 1}/\/([0-9]{1,2})\.([0-9]{1,2})$/{/preg_match}-{preg_match 2}/\/([0-9]{1,2})\.([0-9]{1,2})$/{/preg_match}
L'Argomento è stato bloccato.

Re: chapter shortcut? 12 Anni, 3 Mesi fa #2971

  • admin
  • Offline
  • Administrator
  • Messaggi: 1603
Of course,
it happens when you're so "cool" to write regular expression without to test...

Happy to hear problem is solved.

Cheers,
Luigi
L'Argomento è stato bloccato.
  • Pagina:
  • 1
Moderatori: admin
Tempo generazione pagina: 0.59 secondi
Cerca con Google
News
Chi è online
 162 visitatori online
Sponsor

slotmachineaamsonline.com è una guida alle migliori slot machine online legali in Italia. Sul sito trovi un elenco sempre aggiornato dei casino online con Slot machine e bonus slot, le ultime novità dal mondo delle slot online e le migliori strategie per vincere. Inoltre, è disponibile una sezione dedicata alle slot machine da BAR che finalmente sono disponibili nella versione online.