Solved

does <?php echo html ; ?> slow my site

Posted on 2007-12-06
5
393 Views
Last Modified: 2008-02-01
Hi experts,

In a file called config.php  I have this variable:
$path_to_pics = 'can/forum/picture';

And in the rest of the site I replaced every picture:
<img src='can/forum/picture/rtl.gif' />
With :
<img src='<?php echo $path_to_pics ?>/rtl.gif' />

Is this going to affect the speed of my site or the use of the server?
If yes, what is the best way to deal with this?


Regards,
0
Comment
Question by:uk1900
  • 3
5 Comments
 
LVL 2

Accepted Solution

by:
TheHound earned 200 total points
ID: 20425704
It will hardly effect things. Maybe a few milliseconds here and there, but it shouldn't be noticeable unless your server is unusually slow.

-TheHound
0
 
LVL 21

Assisted Solution

by:nizsmo
nizsmo earned 150 total points
ID: 20425706
Should not, I use this myself, and with/without the path appending with the PHP, I do not notice any loading time differences (tried testing it once or twice, and no time differences).
0
 
LVL 2

Expert Comment

by:TheHound
ID: 20425711
By the way, it will do you more good than bad anyway because if you ever changed a directory, you just need to change one variable.
0
 
LVL 25

Assisted Solution

by:imitchie
imitchie earned 150 total points
ID: 20425713
Not by any noticeable amount.  Check out free php websites like drupal, phpbb or joomla - there are a hundred times more complex and has many more $references!
0
 
LVL 2

Expert Comment

by:TheHound
ID: 20425738
What imitchie said is quite true. Think of forums software such as IPB. They have thousands of lines of PHP code just like yours, and it takes under a second.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

735 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