Welcome to Geeklog, Anonymous Thursday, February 06 2025 @ 05:15 pm EST

Geeklog Forums

passing variables between blocks


Bill

Anonymous
Hello,

I am new to geeklog and have searched around and cannot seem to figure out how to pass variables between blocks. For example, say i have a url linking to my geeklog such as:

http://www.mysite.com/?variable=abcde

When my geeklog page loads I want to pull that variable "abcde" into my header, blocks, footer, and other areas...such as staticpage, stories, etc.

Is there an easy way to do this? That variable will change from time to time so thus I cannot have it static in the page.

Any help would be greatly appreciated.

Thanks :-)
Bill
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
Are you also new to PHP? If you want to access the variables in the URL you use the $_GET PHP variable.
 Quote

Bill

Anonymous
actually i am pretty new to PHP as well. I know about the GET command but that does not seem to work in the blocks. I have tried to insert that command in the header with no luck either. The only place I am able to use that command effectively is if I create a staticpage.

Therefore, I can grab the command in a staticpage but have no clue how to also capture the variable in the url in both the header and the blocks.


 Quote

mach

Anonymous
create a php block that calls the following function, which you should place into your lib-custom.php:
Text Formatted Code
function phpblock_getget(){
    if (isset($_GET['variable'])){
        $variable = $_GET['variable'];
    }
    return $variable;
}
 
something like that.
 Quote

All times are EST. The time is now 05:15 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content