coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: djriknet1 on January 24, 2007, 03:26:31 PM

Title: add php content in the theme
Post by: djriknet1 on January 24, 2007, 03:26:31 PM
Dear everybody,

I Like to have this:
<link rel="StyleSheet" href="dtree.css" type="text/css" />
<script type="text/javascript" src="dtree.js"></script>

<?php

require_once (
"../gallery/outside/cpmfetch.php");
require_once ("../gallery/outside/plugins/dtree.php");
$objCpm = new cpm("../gallery/outside/cpmfetch_config.php");
$dtree = new cpm_dtree($objCpm);
print $dtree->getHeaderContent();

?>



in the head of the template, and this:


<div class="dtree">
<p><a href="javascript: d.openAll();">open all</a> | <a href="javascript: d.closeAll();">close all</a></p>

<?php print $dtree->getTree(); ?>


</div>



somewhere in the code where the anycontent cannot be used (side navigation bar)

the thing i like to display is visable here:
http://www.tropicalview.net/newsletter/index.php


Please let me know, if i just put those 2 parts in the template.html it doesn't work, so i think it should be located in the theme.php.

For the ones who like to see the code, i will attach the index.php as shown  above  and a zip of my theme

Greetings

Hendrik
Title: Re: add php content in the theme
Post by: Gizmo on January 24, 2007, 03:38:37 PM
Try the {CUSTOM_HEADER} or {CUSTOM_FOOTER} tags. Check the manual or search the forum for info on these.
Title: Re: add php content in the theme
Post by: djriknet1 on January 24, 2007, 03:53:19 PM
if i put this part: 

<?php

require_once (
"../gallery/outside/cpmfetch.php");
require_once ("../gallery/outside/plugins/dtree.php");
$objCpm = new cpm("../gallery/outside/cpmfetch_config.php");
$dtree = new cpm_dtree($objCpm);
print $dtree->getHeaderContent();

?>



in a tree.php file
and include this in custom header:
/gallery/tree.php


I will get this:

getHeaderContent(); ?>   

in top of my page.


Still the same, the require_once will not be used it seems.
Title: Re: add php content in the theme
Post by: Gizmo on January 24, 2007, 04:21:02 PM
If you're going to be using this in your gallery then why not just follow the steps in the DTree post (http://forum.coppermine-gallery.net/index.php?topic=13234.0). Only if you wish to show this structure on an external webpage do you need to use cpmFetch.
Title: Re: add php content in the theme
Post by: djriknet1 on January 24, 2007, 04:25:59 PM
Toghether with Vuud, we programmed it in cmpfetch.
and now it's working very fast, instead of about 4 seconds to collect the information with the normal DTREE

So I like to use it with the CMPFetch
Title: Re: add php content in the theme
Post by: vuud on January 25, 2007, 11:30:44 PM
Quote from: Gizmo on January 24, 2007, 04:21:02 PM
If you're going to be using this in your gallery then why not just follow the steps in the DTree post (http://forum.coppermine-gallery.net/index.php?topic=13234.0). Only if you wish to show this structure on an external webpage do you need to use cpmFetch.

Hey Gizmo,

For speeds-sake using it outside of a template and inside a template, we integrated dtree with cpmfetch.  Its actually really really fast - I ended up having to make two SQL calls to get all the information (breaking cpmfetch's long standing tradition of one sql call for anything).  I took a look at the existing code in that link and there were a great many SQL calls being made.  So the larger your gallery, the more calls it had to make...

The only reason I ended up at two calls was that I could not come up with one SQL call that would include both empty categories and albums unassigned.  Ah well. 

I have not checked, but cpmfetch should also use the existing connection, so there is no extra DB connection delay.  I think.

Take care,

Vuud



Title: Re: add php content in the theme
Post by: Gizmo on January 26, 2007, 01:10:30 AM
Sorry, I didn't know you were developing a new tool. I couldn't find any reference with dtree and cmpFetch but this sounds like a better solution if you can reduce the loading time by that much. :D  Not sure why it's not working using the {CUSTOM_HEADER} tag but if you attach the dtree.php file, I'll be happy to help in anyway I can. I assume the dtree.php file referenced above is different than the one that came with the original plugin.