473,386 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to use php variable in .js file

plz help

I have a php variable $content on page menu.php
now i wnt to use its value on page menu_items.js

hear menu_items.js create a menubar.its contan both static and dynamic menu

my lase menu as vander is dynamic now how can i use this variable on .js

my js file look like

['OUTDOOR LIVING', 'http://www.designresourcestlouis.com/outdoorliving/index.php', null,
['Landscaping', 'http://www.designresourcestlouis.com/outdoorliving/landscaping.php'],
['Pool & Fence', 'http://www.designresourcestlouis.com/outdoorliving/poolfence.php'],
['Hot Tubs', 'http://www.designresourcestlouis.com/outdoorliving/hottubs.php'],
['Decks & Patios', 'http://www.designresourcestlouis.com/outdoorliving/deckspatios.php'],
['Outdoor Furniture', 'http://www.designresourcestlouis.com/outdoorliving/furniture.php'],
['Kitchens & Living Spaces', 'http://www.designresourcestlouis.com/outdoorliving/kitchensliving.php'],
['Sunrooms & Porches', 'http://www.designresourcestlouis.com/outdoorliving/sunrooms.php']
],
['VENDORS', 'http://www.designresourcestlouis.com/vendors/category.php', null,

in this space i want my variable value
],

my variable contain value
['1', '../subcategory.php?id=14', null,['111', '../listing.php?id=1', null,],['13', '../listing.php?id=3', null,],['14', '../listing.php?id=4', null,],['fegvrbt5 bh', '../listing.php?id=5', null,],],['2', '../subcategory.php?id=15', null,['111', '../listing.php?id=1', null,],['14', '../listing.php?id=4', null,],],['3', '../subcategory.php?id=16', null,['111', '../listing.php?id=1', null,],['12', '../listing.php?id=2', null,],['13', '../listing.php?id=3', null,],['14', '../listing.php?id=4', null,],],['aa', '../subcategory.php?id=17', null,[';..,/,Ltytryrty', '../listing.php?id=6', null,],],['ankur', '../subcategory.php?id=18', null,['fegvrbt5 bh', '../listing.php?id=5', null,],],['test', '../subcategory.php?id=20', null,[';..,/,Ltytryrty', '../listing.php?id=6', null,],],['tgrhth', '../subcategory.php?id=19', null,['111', '../listing.php?id=1', null,],],
May 9 '07 #1
1 3448
Motoma
3,237 Expert 2GB
You can do this by having your .js file be a .php file instead. Then when you include it, you can drop your PHP variables in and everything should work fine.
May 9 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Dan Elliott | last post by:
Hello, Converting from a working C program to C++, I run into the following error: I have a header: (header.h) namespace shared{ ... struct X{ ...
10
by: Altman | last post by:
I have only done a little programming in C++ so I am still learning but I am having a problem with a variable that is changing on me. I have tried this 2 ways with the same result. I have a...
7
by: Greg Collins [MVP] | last post by:
Hi, I couldn't find what I was looking for by searching the newsgroup, but perhaps these have already been discussed somewhere. This is a bit long with a lot of interrelated questions. What I've...
4
by: thomasp | last post by:
In the code below I have a function that tests if a file exists. It takes a variable named strFileName, simple enough. My question is, is there a way to pass it a variable with another name as...
6
by: shaun | last post by:
If I put (define) const variables at the top of a .cpp file but do not declare them in the .h file, are they only visible within that .cpp file? e.g. const int a={1,2,3,4}; in a cpp file...
2
by: simon | last post by:
hello, what i'm looking to do is store the path of the app on a the server for reuse in the site. my thoughts so far are... -make a key in the web.config file -retrieve the value in globals.asax...
2
by: paladin.rithe | last post by:
I have no clue if this can be done, but I thought I'd ask anyway. I have a modular system where I store module information in a database. One of the types of modules that I have is one that,...
13
by: GGawaran | last post by:
First off, Hi everyone new to .asp and am trying to self teach myself. Im trying to figure out what exactly im doing wrong, or maybe what I think I can do, I really cant. The Idea....
112
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions...
11
by: Jef Driesen | last post by:
I have the following problem in a C project (but that also needs to compile with a C++ compiler). I'm using a virtual function table, that looks like this in the header file: typedef struct...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.