Solved

PHP --> PHP and HTML

Posted on 2004-08-14
5
278 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 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now