Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP,GeoIP and trying to pass a variable

    I have a dating site and my objective is to alter the landing page to show members from the visitors region. I've successfully installed GeoliteCity and currently able to echo a users "general" location on the homepage with this;

    PHP Code:
    php echo $location
    I'm trying to insert "$location" into a script that calls profiles.
    Code:
    <h3 class="members">Members near  <?php echo $location;?></h3>
    	<div class="block members">
    	{members:limit=10,profile_state=$location,cache_time=0}
    	</div>
    As hard as I try, I've decided this isn't going to work. Apparently it has to do with passing a variable outside of PHP. I've also tried $SET_SESSION_ID and use that as a variable, which I haven't completely given up on.
    Normally I'd rather take a beating than ask for help as there's a wealth of info available, but I'm just not sure of the best way to proceed or the proper search term to google. I'd be obliged by some thoughts on this.

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,538
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    Did you try this yet?

    <h3 class="members">Members near <?=$location?></h3>
    <div class="block members">
    {members:limit=10,profile_state=<?=$location?>,cache_time=0}
    </div>

    The server should process the PHP first, before sending it to your browser,
    but I'm not sure of when the {members: ... } part gets processed.
    Doing the thing above is worth a try though.


  •  

    Tags for this Thread

    Posting Permissions

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