Simple PHP Blog Integration
|
kilbad2
Joined: 2005-07-14
Posts: 3 |
Posted: Thu, 2005-07-14 07:00
|
|
I am currently using Simple PHP Blog (http://www.simplephpblog.com) for a site that I am running and I want to embed/integrate gallery 2 into it. The makers of this script provide a template file to include html and php code within the blog wrapper (I have included the template code below). MY QUESTION: Is there some way to include the pieces of the blog template code in the global.tpl file in the gallery templates/local directory? My current website structure is such that the gallery2 and simplephpblog have their own directories. WHAT I TRIED: Initially, I tried to created symbolic links in the gallery directory to connect over to the blog directory so I could keep the ‘require’ references in the blog template the same (for the script and language directories) as I attempted to insert it into the global.tpl file. I also inserted all the sections of php code from the blog template file between {php}{/php} tags. However, all of this did not result in success. Can someone help me through this, I feel like it should not be that hard? The Simple PHP Blog Template (also here):
<?php
require('scripts/sb_functions.php');
global $logged_in;
$logged_in = logged_in( false, true );
read_config();
require('languages/' . $blog_config[ 'blog_language' ] . '/strings.php');
sb_language( 'index' );
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo( $lang_string['html_charset'] ); ?>" />
<link rel="stylesheet" type="text/css" href="themes/<?php echo( $blog_theme ); ?>/style.css" />
<?php require('themes/' . $blog_theme . '/user_style.php'); ?>
<script type="text/javascript" language="javascript" src="scripts/sb_javascript.js" />
<title><?php echo($blog_config[ 'blog_title' ]); ?></title>
</head>
<?php
function page_content() {
$entry_array = array();
$entry_array['subject'] = "Subject Line";
$entry_array['entry'] = "Body Content i.e. GALLERY 2";
echo( theme_staticentry( $entry_array ) );
?>
<?php
}
theme_pagelayout();
?>
</html>
|
|

Posts: 32509
any customizations you do with your current g2 version are lost when upgrading to the current version or to beta 4.
the layout / theme system was changed.
so please first get the latest nightly snapshot:
http://codex.gallery2.org/index.php/Gallery2:faq#How_to_upgrade_Gallery2.3F
and then customize it in themes/matrix/templates/local/*.tpl
- yes, you can include your own html in the template files.
- yes you can add your own php in the template files in {php}print "hello world"; {/php} tags
. i don't see the g2 integration code, can't tell you if you're doing anything wrong.
Posts: 3
First, let me thank you for your prompt response. I am so impressed with Gallery and your great technical support.
Since your reply, I downloaded the snapshot and upgraded with no problem. Then I made symbolic links in the gallery 2 directory to all the simplephpblog directories. After that, I attempted to integrate the simplephpblog template into the gallery 2 themes .tpl file. The result is that when I access the gallery 2 (main.php) I get a page that displays the blog wrapper, which I was pleased to see, but an error where the gallery 2 should be embedded. Below I have included the error and the code of my .tpl file. Can you help me fix this?
Thanks again!
The error:
Fatal error: Call to a member function on a non-object in /web/kilbad.com/wa2000/gallery2/g2data/smarty/templates_c/%%3617484692/%%3A^3A8^3A818B59%%theme.tpl.php on line 49My themes .tpl file (for matrix):
{* * $Revision: 1.3 $ * If you want to customize this file, do not edit it directly since future upgrades * may overwrite it. Instead, copy it into a new directory called "local" and edit that * version. Gallery will look for that file first and use it if it exists. *} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> {php} require('scripts/sb_functions.php'); global $logged_in; $logged_in = logged_in( false, true ); read_config(); require('languages/english/strings.php'); sb_language( 'index' ); {/php} <head> <meta http-equiv="Content-Type" content="text/html;" /> <link rel="stylesheet" type="text/css" href="themes/modern/style.css" /> {php} require('themes/modern/user_style.php'); {/php} <script language="JavaScript" src="scripts/sb_javascript.js"></script> <title>Wheaton Academy Class of 2000 Gallery</title> {* Let Gallery print out anything it wants to put into the <head> element *} {g->head} {* If Gallery doesn't provide a header, we use the album/photo title (or filename) *} {if empty($head.title)} <!--<title>{$theme.item.title|default:$theme.item.pathComponent|markup:strip}</title>--> {/if} {* Include this theme's style sheet *} <link rel="stylesheet" type="text/css" href="{g->theme url="theme.css"}"/> </head> <body class="gallery"> {php} function page_content() { $entry_array = array(); $entry_array['subject'] = "Subject Line"; $entry_array['entry'] = "Body Content"; echo( theme_staticentry( $entry_array ) ); {/php} <div id="gallery" {g->mainDivAttributes}> {* * Some module views (eg slideshow) want the full screen. So for those, we * don't draw a header, footer, navbar, etc. Those views are responsible for * drawing everything. *} {if $theme.useFullScreen} {include file=$theme.moduleTemplate} {else} <div id="gsHeader"> </div> <div id="gsNavBar" class="gcBorder1"> <div class="gbSystemLinks"> {g->block type="core.SystemLinks" order="core.SiteAdmin core.YourAccount core.Login core.Logout" othersAt=4} </div> <div class="gbBreadCrumb"> {g->block type="core.BreadCrumb"} </div> </div> {* Include the appropriate content type for the page we want to draw. *} {if $theme.pageType == 'album'} {g->theme include="album.tpl"} {elseif $theme.pageType == 'photo'} {g->theme include="photo.tpl"} {elseif $theme.pageType == 'admin'} {g->theme include="admin.tpl"} {elseif $theme.pageType == 'module'} {g->theme include="module.tpl"} {elseif $theme.pageType == 'progressbar'} {g->theme include="progressbar.tpl"} {/if} <div id="gsFooter"> </div> {/if} {* end of full screen check *} </div> {php} } theme_pagelayout(); {/php} {* * Give Gallery a chance to output any cleanup code, like javascript that * needs to be run at the end of the <body> tag. If you take this out, some * code won't work properly. *} {g->trailer} {* Put any debugging output here, if debugging is enabled *} {g->debug} </body> </html>Also, incase you visit my website, I have restored the default .tpl file until I resolve this. Therefore, the result of this modified .tpl file is not avalible on my server (if you yould like it to be, please indicate that in your reponse).
Posts: 31
Was there any update on this? I am looking to do something similar.