Forums

[resolved] Passing HTTP Get parameters.... (6 posts)

  1. sdwood
    Member
    Posted 1 year ago #

    Hi,

    I might be barking up the wrong tree here...I currently have a standard PHP application that i am trying to migrate to WP. Chiefly this is so I can manage copy etc via the WP admin console. So i have some pages that currently take HTTP query params which the PHP code uses to lookup a MySQL database, pretty standard fare. So lets say that i have some users and currently a page that looks like /users?userId=143523 is used to fetch the users details from the database and combine this with some static HTML output. What I think i would like to do is have a wordpress template page that will allow me to edit the copy for this page without having to FTP a new copy of the file onto the server.

    So if i had a custom template that renders the copy i want and the links etc i want in a profile page - along with the dymanic database driven content which i will get by looking up the database - is this possible ? For example maybe i could create a new page called users, based on a template called profile-page.

    I guess my question is basically can i do this in wordpress and how would I go about it ? It seems that trying to create a "page" manually for each user using the user-template custom template with a custom field would work, but this wont work when a new user signs up obviously, although i would also like the URL structure that WP would give me for this. Maybe there is something i am not understanding ?

    thanks,
    Steve.

  2. vtxyzzy
    Member
    Posted 1 year ago #

    It is certainly possible to pass parameters in the URL with WP. I am doing that with categories. I use the code below to add the 'stayincat' parameter to the permalink for a page. The user clicks on the page title and the URL passes the stayincat parameter to the page template:

    <h2><a href="<?php echo htmlentities(add_query_arg('stayincat',get_query_var('cat'),get_permalink())) ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
  3. sdwood
    Member
    Posted 1 year ago #

    Hi,

    Many thanks for your reply. I think the problem was that when i had a slug e.g.

    mydomain.org/member/?memberId=1234

    I was making URLs like member?foo=bar and it should be member/foo=bar.

    Thanks,
    Steve.

  4. vtxyzzy
    Member
    Posted 1 year ago #

    I was making URLs like member?foo=bar and it should be member/foo=bar.

    Did you have a typo in the line above? It should be member/?foo=bar

    If your problem is solved, please use the dropdown at top right to mark this topic 'Resolved'.

  5. sdwood
    Member
    Posted 1 year ago #

    Yes - a typo - thans very much for your help.

  6. vtxyzzy
    Member
    Posted 1 year ago #

    You are welcome. Now, please use the dropdown at top right to mark this topic 'Resolved'.

Topic Closed

This topic has been closed to new replies.

About this Topic