We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10076
    • 1,024 Posts
    I am trying to work out a snippet, and it sends a url to the browser
    .../index.php?number of page
    .
    www.pianoquartet.nl/index.php?40 it keeps taking me to the site start and not to the page I want it to go.
    I tried without FURL turned on, no change. I keep scratching my head, any reason for this?

    MODX 9.6.1p
    WIN xp sp2
    FF & IE7
      • 7231
      • 4,205 Posts
      Try adding the id parameter:
      .../index.php?id=number of page


      If you are creating a link with a snippet you may want to try the makeUrl() api function:
      http://wiki.modxcms.com/index.php/API:makeUrl
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        You should definitely use the API function $modx->makeURL() in snippets or TVs using @EVAL, (and otherwise the [~xx~] tags) and let MODx work out how to create the URL. What happens if you have index.php?id=xxx scattered all over your site, then it is decided to use Friendly URLs? Good luck changing them all!

        makeUrl($id, $alias= '', $args= '', $scheme= '')
        

        $id is the document ID of the page to link to - required.

        $alias is the document’s alias - optional - if you want to skip this one and specify any of the others, you must use an empty string ( ’’ ) as its placeholder.

        $args - optional - is for any query string arguments you want such as ’action=delete&user=user-to-delete’ (MODx will append the proper starting delimiter, ? or &, depending on whether you’re using friendly URLs or not). Again, if you want to use the last one, you need to use an empty string ( ’’ ) to hold its place.

        $scheme - optional - is to specify HTTP or HTTPS.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 10076
          • 1,024 Posts
          I am trying to use a query string to let the user either view details of a table entrie, modify the table, or delete that entrie. I am doing that with this bit of code
          </a><a href=\"index.php?40&idpub=$row[idpub] &idpdel=$idpubdelete &idpmod= $idpubmod &pubchar=$pubchar\" title=\"$name\"><img src=\"http://www.pianoquartet.nl/assets/snippets/nbscripts/images/edit.png\" alt=\"Edit $name 's details\" title=\"Edit $name 's details\" style=\"border:0\"></a>


          It is just the "modify details" link but it takes me to the site start. It used to work with this bit of code but was very unpractical.

          $pubmodlink = "<a href=\"/index.php?id=".$idpubmod."&idpub=".$idpub."&pubchar=".$pubchar."\">";
          $pubmodlink = $pubmodlink . "Modify $name  's details?" . "</a>";


          When hitting the link, on the bottom of the browser the the URL constructed there look identical. Still from the first bit of code I am taken to the site start the latter takes me to the page containing the call to the modify script. The scripts are external scripts. I am not, yet, able to create these codes as snippets.