Solved

Understanding PHP code - absolute path

Posted on 2009-07-15
7
203 Views
Last Modified: 2013-12-13
I am working on a php web application. Trying to understand the path to files:
What does following code means?

img src="$$application_settings::base_path$$images/header.gif"

Why are there two dollar signs? (it's php 4.4.7)

0
Comment
Question by:awarraic
7 Comments
 
LVL 18

Expert Comment

by:Greg Alexander
ID: 24859409
I never use $$ but here is the explanation of it:

http://www.php.net/manual/en/language.variables.variable.php
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 250 total points
ID: 24859446
No this is template system. Somewhere you configure the value for application_settings::base_path and then in that file $$application_settings::base_path$$ is replaced by the template engine with the configured/calculated value. This has nothing to do with the $$ of php beasue you would get something like:

img src="foo::base_pathBAR/header.gif"

in your html
0
 

Author Comment

by:awarraic
ID: 24859478
How do I make that header display?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 48

Assisted Solution

by:hernst42
hernst42 earned 250 total points
ID: 24859561
> Why are there two dollar signs? (it's php 4.4.7)
beacuse the programmer defined that variables for his template engine are stored between $$ and $$. Could also be ## and ##

> How do I make that header display?
Configure the template engine correctly.
0
 
LVL 19

Expert Comment

by:NerdsOfTech
ID: 24875584
*** $$ IS EXTREMELY DANGEROUS ***

Basically,

$$image will create a "PHP variable" with the name CONTAINED in the variable $image.

so if:
$image = 'pictures';
$$image would reference a variable named $pictures

Wha you want is to just change it to:
img src="http://www.yourwebsite/com/images/header.gif" // path to header.gif

Open in new window

0
 
LVL 19

Expert Comment

by:NerdsOfTech
ID: 24875587
Correction $$ will reference a variable based on the $variable

so if:
$image = 'pictures';
$image would reference a variable named $pictures
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now