PDA

View Full Version : Embedding html in v.1.5 (tutorial)


Pekka
28th of September 2003 (Sun), 17:05
As you may know, you have a new html output system in 1.5, for advanced users this is a way to integrate EE to your site and pick parts of html output from list or photo page to different parts of the site.

The page template is chosen by using parameter "html". I have done one demonstation of "stripped down" template which displays only header and thumbs, it is called "embed". You can do and save and use as many page templates as you need.

So what do the page template files do? Compare output of these links (right-click and open to new window, or jsut drag and drop to another browser window):

link (http://photography-on-the.net/gallery/list.php?exhibition=1&pass=public&lang=fin&select_output=microthumbs&perpage=10)

vs.

link (http://photography-on-the.net/gallery/list.php?exhibition=1&pass=public&lang=fin&select_output=microthumbs&perpage=10&html=embed)

There are two new output styles just for plain thumb display (no table code): 'just_thumbs.php' and 'just_microthumbs.php'. You apply the desired output style using "select_output=plain_thumbs" parameter, like in

link (http://photography-on-the.net/gallery/list.php?exhibition=1&pass=public&lang=fin&select_output=just_thumbs&perpage=10&html=embed)

Then you can also govern per page by "perpage" parameter:

link (http://photography-on-the.net/gallery/list.php?exhibition=1&pass=public&lang=eng&select_output=just_microthumbs&perpage=27&html=embed)

Perpage can be non-even number, not 10 20 50 like in EE interface. EE will correct it automatically to closest one when you click the link and arrive to "real" EE photo page.



Then something for REALLY advanced webmasters :)

As EE works most of the time directly on SQL tables as variables, the sorts and searches uses those table names. This means doing a search using template system and embedding needs some care so that you won't get database errors. There are some single language tables which are safest to use for now:

ee_photo.ee_photo_id
ee_photo.ee_photo_exif_datetime
ee_photo.ee_photo_exif_iso
ee_photo.ee_photo_exif_shutter
ee_photo.ee_photo_exif_aperture
ee_photo.ee_photo_exif_mode
ee_photo.ee_photo_exif_metering
ee_location.ee_location_name
ee_owner.ee_owner_name
ee_photo.ee_photo_orientation

all of which you can use in sorting and search quite easily as in

link (http://photography-on-the.net/gallery/list.php?exhibition=1&pass=public&search_row=ee_photo.ee_photo_exif_iso&keyword=100&lang=eng&select_output=just_microthumbs&perpage=5&html=embed)

Getting data out from EE this way has some advantages you don't get from normal EE photo browser interface. Above search searches _exactly_ keyword 100, and not 1000, too like standard EE. If you need to have wildcards, use % (as *) and _ (as ?).

Want to get five _horizontal_ images?

link (http://photography-on-the.net/gallery/list.php?exhibition=1&pass=public&search_row=ee_photo.ee_photo_orientation&keyword=h&lang=eng&select_output=just_microthumbs&perpage=5&html=embed)

Only photos with evaluative metering:

link (http://photography-on-the.net/gallery/list.php?exhibition=1&pass=public&search_row=ee_photo.ee_photo_exif_metering&keyword=eval&lang=eng&select_output=just_microthumbs&perpage=50&html=embed)

Sort order is done with

order=DESC

and

order=ASC

and sort fields are chosen from

sort_row=custom
sort_row=id
sort_row=header
sort_row=date
sort_row=lens
sort_row=iso
sort_row=shutter
sort_row=f
sort_row=mode
sort_row=metering
sort_row=country
sort_row=location
sort_row=counter
sort_row=photographer
sort_row=exhibition
sort_row=camera
sort_row=flash
sort_row=support
sort_row=light
sort_row=evcorr
sort_row=focal
sort_row=orientation

"custom" order means Author's order and "f" is aperture.

In exhibition "all" means "all exhibitions combined". It still shows only those exhibitions which are under given pass, as EE always does.

As you combine all these parameters you start to have fun with EE embedding. This one fetches 200 photos with

- evaluative metering
- english language
- as plain microthumbs
- sorted by date in descending order
- from all exhibitions under password 'public'

link (http://photography-on-the.net/gallery/list.php?exhibition=all&pass=public&search_row=ee_photo.ee_photo_exif_metering&keyword=eval&lang=eng&select_output=just_microthumbs&perpage=200&sort_row=ee_photo.ee_photo_exif_datetime&order=DES C&html=embed)

To make these URL's display the result right in a page you will need to use some scripting language like PHP or PERL. In PHP command

<?php
include(" http://url.here";);
?>

Embeds the html result of the URL right into a page. This is usually restricted to your own server for safety reasons.

seanspeng
30th of September 2003 (Tue), 21:51
Pekka,

This is a great add-on to the EE and help us to better integrate with other site.

A question/request though, unless I missed anything, how do you include "Random" photos?

I tried the refreshing, and the photos displayed are all the same. To be specific, how can I include "One" "Random" Photo from a particular exhibition on other page?

Thank you!

Pekka
1st of October 2003 (Wed), 06:14
seanspeng wrote:
Pekka,

This is a great add-on to the EE and help us to better integrate with other site.

A question/request though, unless I missed anything, how do you include "Random" photos?

I tried the refreshing, and the photos displayed are all the same. To be specific, how can I include "One" "Random" Photo from a particular exhibition on other page?

Thank you!

I'm going to make a separate "ee_snippets.php" page which builds several special html blocks for embedding purposes, e.g. letting you pick up random photos listing like in index page by exhibition, with extra parameters for amount and thumb size.

Just give me few days to get there. :)

daddy0
1st of October 2003 (Wed), 07:03
There seems to be a little bug in your code. It generates the link wrong. Here is an example of link:

http://127.0.0.1/photography-on-the.net/gallery/photo.php?photo=426&exhibition=4&offset=1&lang=fin

It should be like this:

http://www.mikkolevo.com/gallery/photo.php?photo=426&exhibition=4&offset=1&lang=fin

Same problem can be found on using demo links you provided above.

I really would like to see embedding function without title above pictures.

Regards,

Mikko

Pekka
1st of October 2003 (Wed), 07:30
Good point. This is one more thing I forgot to mention (and to change on this site): your gallery root URL, with slash in the end, must be edited to /pagetemplates/list/embed.php (and all variations of it) as in

$s_ee_html_root = "http://photography-on-the.net/gallery/'";

And if you don't want the header, change

<table border="0" cellspacing="0" cellpadding="0"><tr>
<td align="left"><p>
<?php print $exhibition_header_html; ?>
</p> </td>
</tr></table>
<table border="0" cellspacing="0" cellpadding="0"><tr>
<td>
<?php print $list_html; ?>
</td>
</tr></table>


to


<table border="0" cellspacing="0" cellpadding="0"><tr>
<td>
<?php print $list_html; ?>
</td>
</tr></table>

and save it as "embed_simple.php"

Now you can refer it with parameter

html=embed_simple

I did this, and also removed style sheet from my embed_simple.php template, and this outputs:

link (http://photography-on-the.net/gallery/list.php?exhibition=1&pass=public&search_row=ee_photo.ee_photo_exif_metering&keyword=eval&lang=eng&select_output=just_microthumbs&perpage=50&html=embed_simple)

Ewan
19th of January 2004 (Mon), 11:18
I'm going to make a separate "ee_snippets.php" page which builds several special html blocks for embedding purposes, e.g. letting you pick up random photos listing like in index page by exhibition, with extra parameters for amount and thumb size.

Just give me few days to get there. :)

Has this been done yet?

If not, can you please tell me how would I embed

1. a random image

2. the latest image

Also - this is probably just basic php stuff - how do I suppress the warning in http://www.oaktreephoto.co.uk/embedtest.php?

(Warning: main(): stream does not support seeking in /home/oaktreep/public_html/embedtest.php on line 2)

The code is simply:

&lt;?
include("http://www.oaktreephoto.co.uk/list.php?exhibition=20&amp;pass=public&amp;lang=eng&amp;select _output=just_thumbs&amp;perpage=5&amp;html=embed_simple");
?>

Regards,
Ewan

Ewan
23rd of January 2004 (Fri), 03:35
just pushing to the top :)

Pekka
23rd of January 2004 (Fri), 05:31
I'm going to make a separate "ee_snippets.php" page which builds several special html blocks for embedding purposes, e.g. letting you pick up random photos listing like in index page by exhibition, with extra parameters for amount and thumb size.

Just give me few days to get there. :)

Has this been done yet?

Partly. It will be there in release version.

Also - this is probably just basic php stuff - how do I suppress the warning in http://www.oaktreephoto.co.uk/embedtest.php?

(Warning: main(): stream does not support seeking in /home/oaktreep/public_html/embedtest.php on line 2)

The code is simply:

&lt;?
include("http://www.oaktreephoto.co.uk/list.php?exhibition=20&amp;pass=public&amp;lang=eng&amp;select _output=just_thumbs&amp;perpage=5&amp;html=embed_simple");
?>

Regards,
Ewan

This is Zend Optimizer bug. Place @ in front of include to suppress the error message:

@include("foofofofofo...");

Ewan
23rd of January 2004 (Fri), 05:35
Many thanks. :)

devenh
9th of February 2004 (Mon), 09:47
Could you provide an example of how to embed a link that will return all the photos in a category in an exhibition? IOW, where Exhibition=1 and Category=Soccer.

Is it possible to do something like Exhibition=All and Category=Soccer?

Deven

devenh
9th of February 2004 (Mon), 15:49
I figured it out :D

<a href="http://www.yourserver.com/gallery/list.php?exhibition=1&category=16">Category</a>

Cyclist
22nd of November 2004 (Mon), 02:58
It tried the embedding html but the navigation bar (next / previous page )is gone... how is it possible to include the navigation?