Solved

PHP --> PHP and HTML

Posted on 2004-08-14
5
295 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

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 …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

752 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