Jump to content

Make function akin to a SuperGlobal?


Kenai

Recommended Posts

Hi there.

 

I am a very new scripter, and have just now started using PHP (end of last week), and I have a question about implementation of my code.

 

Background ->

So that I can easily manage site navigation on my project site, I have created a script that takes info from a MySQL table, and generates a complex unordered list (to be used with Tanfa's Menus). I wish to use this script in all pages of my project site.

(My testing server is XAMPP Lite for Windows (only mods are passwords), and my final destination is unmodded Bluehost)

 

Problem ->

I don't want multiple copies of the same script all over the place. I would like to make my script akin to a SuperGlobal, so that all I would need to do is put

<?php
ahopeforNav();
?>

in my pages, and it would make that nice list. As I am a novice scripter, as I learn more this would be best as I could change only the one function's code once, and it would be put into use on all pages.

 

Question ->

Is there any way to make a function that is callable from all pages on a site?

 

I have google'd every keyword and phrase I can think of, but I didn't find anything.

 

If anybody can help me, I would appreciate it :)

 

 

(by the way, I am very ill today, so please forgive me if this post is somewhat incoherent or non-understandable. Normally I don't post to forums or message boards if I am ill, but my project work needs done post haste, and this is part of what I have to do.  :-[)

Link to comment
https://forums.phpfreaks.com/topic/107404-make-function-akin-to-a-superglobal/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.