Martina,
I use a config.php or an init.php.  And in that file, I set any
globals, db connections, and include css, and js scripts.
Then I make sure that every page on my site includes that config.php.
Since you mentioned that u r using a CMS already I would have thought
that technique was automatically built in.
I am a beginner so maybe my technique is not the best way.  But I will
show you my way and u can decide what works for you.

My config.php looks like this:

define("MYSQLHOST",            "localhost"    );
define("MYSQLUSER",            "yourhostusername"     );
define("MYSQLPASSWORD",  "yourhostpassword" );
define("MYSQLDB",                 "yourdb");
$con = mysql_connect(MYSQLHOST,MYSQLUSER,MYSQLPASSWORD);
mysql_select_db(MYSQLDB);

define("SITE_TITLE",     "WWW.your site title.COM");
define("HOMEURL",        "HTTP://www.your url");
define("HOMEPATH",       "/your home path");
define("APPLIBPATH",     "/your app lib path");

if (isset($_SESSION["username"])) {
  define("USERNAME", $_SESSION["username"]);
  define("MEMBERID", $_SESSION["memberid"]);
  define("LOGGED_IN", true);
} else {

  define("LOGGED_IN", false);

}

/* Check for members only area */
/*************************************/
if(isset($membersonly) && !LOGGED_IN ) {
  header("location:".HOMEURL."/login_form_modal.php?url=".$_SERVER
["PHP_SELF"]);

}

if (!isset($noheaders)) {
echo '
<link rel="stylesheet" type="text/css" href="/global_libs/themes/
smoothness/ui.all.css" />
<script type="text/javascript" language="javascript">
var APPLIBPATH = "/home/apppath";
var MEMBERID ="'.MEMBERID.'";
var USERNAME ="'.USERNAME.'";
</script>
<script type="text/javascript" src="/global_libs/js/jquery.js"></
script>
';};  // end of headers

******** end of config.php ******************

Then at the top of all my site scripts/html pages
I have this:
<?
$noheaders = true; // or false
$membersonly = true;  // or false
include("config.php");
?>

Let me explain my concepts a little.
1. Since there will be times when you will be calling the config.php
from a script that also sends headers and you dont want the headers in
the config.php to throw an error you can turn them off with the
$noheaders flag.

2. Since someone can land at any given url on your site, i created an
additional modal login form that gets called if someone lands on a
secured page. And you flag all of your member only pages by setting
$membersonly = true just before you call your config.php.  That will
tell config.php to check if the user is logged in and let them through
or display a pop-up login form.

3. One more thing I found useful is that I also use the config.php to
set some global JS variables, this helps you in times when you want to
share variables between PHP and JS.

This is my concept, and is not gospel. As I said I am a beginner, but
this is working pretty good for me so far.
I am hoping someone will chyme in and point out some flaws or show us
a better way.

good luck,
hope i have helped a little.
 Mike.

On Aug 25, 9:48 pm, Martina <[email protected]> wrote:
> I have started to use JQuery through out my site and now I have the
> following being used:
>
> <script type="text/javascript" src="/include/JS/jquery-1.3.2.min.js"></
> script>
>         <script type="text/javascript" src="/include/JS/jquery-
> ui-1.7.2.custom.min.js"></script>
>         <script type="text/javascript" src="/include/JS/jquery.cookie.js"></
> script>
>         <script type="text/javascript" src="/include/JS/
> jquery.tools.min.js"></script>
>
> But I  have found that different pages throughout my site use
> different Master pages and some don't use one at all (I am using a
> CMS) and because my JQuery is mostly used in User controls it could be
> on any one of these pages.
>
> So i have had to add the above script tags to a whole range of
> different pages which is getting hard to manage.
>
> Is there some way I can consolidate all this into one js file maybe
> and call it at the top of another js file (because there is one that
> is already reference in every location.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to