Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PHP --> PHP and HTML

Posted on 2004-08-14
5
Medium Priority
?
312 Views
Last Modified: 2006-11-17
I have PHP script to make some parts of may page to collapse.

Now I have a problem. My gallery PHP which I want to integrate this collapse runs on HTML templates. What I want to do is to separate this script in 2 parts so that PHP would be in one file and this collapse part would be in HTML template file.

Here is finished collapse script: http://www.blueprints3d.com/script.txt
Here is template which I want this to be integrated: http://www.blueprints3d.com/template.txt


So if anybody has idea to integrate this PHP to this html, please reply me… 500 points given…
0
Comment
Question by:Aetia
  • 2
  • 2
5 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 1500 total points
ID: 11799040
the template. should also be an php file.
split up the code in script into twio php-files

into the first PHP-file 'preparedata.php' the lines 1-128
into the second PHP-file 'showdata.php' put the lines 144-368

modify the template-file so the first line contains
<?php require_once 'preparedata.php'; ?>

replace the comment
  <!-- Here I want my collapse part to apear -->
whith
  <?php include 'showdata.php'; ?>
0
 

Author Comment

by:Aetia
ID: 11800708
I've tried that but in that case I would have to chagne may main gallery PHP too much.
0
 

Author Comment

by:Aetia
ID: 11800737
Or maybe if someone knows a solution to make it in javascript then that also solves me.

Important is that this collapse thing would be stored in cookies like this:

http://www.blueprints3d.com/templates/bp/bp_info.php
0
 
LVL 2

Expert Comment

by:kaller2
ID: 11802649
Here is another answer you prolly dont wat.....The quick and dirty way to manage stuff at the client is to dump all the stuff down to the client in one monster page (using divs for example)  and then show/hide using style attributes on the divs triggered with javascript.  The server doesnt need to write the cookies, the page can write its own cookies depending on what the user chooses, and so the server doesn't need to even be involved in all the user interaction.  But that is probably more than you want to do....

Is your question really simple?  I mean are you just trying to output the <html> tags themselves too many times?  Why not drop them from the php script and then you can replace/include/assemble the stuff you want in the template ??

Incidentally why not use the numbers 0000 0001 0010 0100 1000 like the powers of two: 1, 2 , 4, 8 to set/test a position. The nice thing is that then you can quickly tell if say two positions are set, using only one test.  So if you want to test that positions 0101 are set (that is called a "mask") then you can do an AND operation to test that.....










0
 
LVL 2

Expert Comment

by:kaller2
ID: 11827736
Also if you want to keep html on the client and use it there, you can also generate it using javascript
document.write ('<tag>blah blah</tag>');
Thats another way to dynamically display some block of html on a page.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
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 count occurrences of each item in an array.
Suggested Courses

885 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