• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

PHP --> PHP and HTML

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
Aetia
Asked:
Aetia
  • 2
  • 2
1 Solution
 
hernst42Commented:
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
 
AetiaAuthor Commented:
I've tried that but in that case I would have to chagne may main gallery PHP too much.
0
 
AetiaAuthor Commented:
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
 
kaller2Commented:
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
 
kaller2Commented:
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

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now