Results 1 to 10 of 10

Thread: dealing with jumpTo page

  1. #1
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default dealing with jumpTo page

    I get a jumpTo page set in a module back as its id number....
    To convert this to a url I can....

    Code:
    $objPage = $this->Database->prepare("SELECT id, alias FROM tl_page WHERE id=?")
    ->limit(1)
     ->execute($objConfig->jumpTo);
    
    if ($objPage->numRows)
    {
    $bookingFormPage = $objPage->alias . $GLOBALS['TL_CONFIG']['urlSuffix'];
    }
    
    $this->redirect($bookingFormPage);
    but what if the website has not elected to use $GLOBALS['TL_CONFIG']['urlSuffix'] ??

    Is there an easier way to convert a page id to its url?

  2. #2
    User
    Join Date
    08-10-09.
    Posts
    31

    Default Re: dealing with jumpTo page

    I always use this code:
    Code:
    $objPage = $this->Database->prepare("SELECT id, alias FROM tl_page WHERE id=?")
    ->limit(1)
    ->execute($objConfig->jumpTo);
    
    if ($objPage->numRows)
    {
        $bookingFormPage = ampersand($this->generateFrontendUrl($objPage->fetchAssoc()));
    }
    
    $this->redirect($bookingFormPage);
    generateFrontendUrl is a method of controller class
    Jaap Jansma

    Walk Wise Webdesign

  3. #3
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: dealing with jumpTo page

    Thats perfect thank you grapio :D

  4. #4
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: dealing with jumpTo page

    And how would you use this to get the url of the page you (that is - the script) is on?

  5. #5
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: dealing with jumpTo page

    Got it.

    Code:
    global $objPage;
    $this->generateFrontendUrl($objPage->row())

  6. #6
    User
    Join Date
    06-19-09.
    Posts
    328

    Default Re: dealing with jumpTo page

    Quote Originally Posted by ramjet
    Got it.

    Code:
    global $objPage;
    $this->generateFrontendUrl($objPage->row())
    or simply:
    (http://api.contao.org/Library/Enviro...thodrequestUri)
    Code:
    $this->import('Environment');
    $this->Environment->requestUri;
    Consulenza Contao CMS https://www.intco.it

  7. #7
    User
    Join Date
    07-26-09.
    Posts
    175

    Default Re: dealing with jumpTo page

    Seriously, Leo should provide a new function that generates frontend url directly from the page id...

  8. #8
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: dealing with jumpTo page

    Seriously, Leo should provide a new function that generates frontend url directly from the page id...
    Have you ticketed for this Tru?
    If not, I will, It would be handy

  9. #9
    User
    Join Date
    07-26-09.
    Posts
    175

    Default Re: dealing with jumpTo page

    No, I haven't yet. Feel free to make a ticket.

  10. #10
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: dealing with jumpTo page

    Seems easy enough. Check beforehand if the alias is supplied, if not retrieve it from the db. The function replaceInsertTags does the same thing for link insert tags; it accepts both alias or id and gets the other argument from the db.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •