Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parsing and page layout

Status
Not open for further replies.

Sleidia

Technical User
May 4, 2001
1,284
0
0
FR
Good Morning to the one who will read this.

Is that exact that PHP parses a page from the top to
the bottom of the source only?

I am accessing a mySql database in my page and this code HAS to be situated in the bottom of the page.
But I want to have an image changed according to the data coming from the database. The only one problem us that this image is situated on the top of the page.

Is there a way to eradicate this problem?

I'm thinking of using a javascript function triggered by the database in order to swap the image source, but I guess there is a "safer" and better solution with php only.

Thanks a lot for you support.
Have a nice day!!!!!!!!!!!


 
You can have your PHP script do a bunch of processing, render the graphic and then start to generate the output of the actual webpage starting with the graphic followed by ???

DjangMan
 
Hello,

Why can't you call a function when the data has changed, or whenever you get some specific data. Pass something to the function so it knows what to change the image too.

You would most likely have to refresh the page.

-Josh
 
why does it have to be at the bottom of the page.
like DjangMan says just start generating the webpage after you have accessed the DB.

PHP engine parses from top to bottom your PHP file.
the output of the PHP engine is what ever your PHP code
outputted and what ASCII was between the PHP code markers
(ie. the stars in --> &quot;?> ****** <?php&quot;)

the PHP engine spits its output to the webserver, which in effect gives you a webpage (PHP engine output.) made of HTML/DHTML/Javascript/VBscript(!??)/etc.

This output is then parsed by your webbrowser ato display a webpage.

---

Another thought:

leave space at the top of the page for the image(maybe a dummy image of the same size. <-- bit inefficient tho.),
and after you have accessed the DB write a line like:

--/

echo &quot;<div style=&quot;position:absolute;top:x;lefty;width:z;height:a;&quot;><IMG SRC=&quot;?&quot;></div>&quot;;

/--

replace x,y,z,a,? with relevant vars/vals

namaste,

jochem
 
$str1 = &quot;this will be at the bottom&quot;;
$str2 = &quot;this will be at the top&quot;;

echo $str2;
echo $str1;

Gather all of the data you need for your page, then re-order the output.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top