Integrating different contents via tabs into serendipity

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Bumble
Posts: 4
Joined: Fri Jul 21, 2006 8:44 pm

Integrating different contents via tabs into serendipity

Post by Bumble »

Hi everyone,
I know a lot about hardware and tweaking windows, and softwares, but I'm a perfect newbie when it comes to php, html and CSS.:oops: However I created a blog, using serendipity of course, and I'm facing my first issues. :?

On my blog, there are tabs at the top (Blog, and Photos), that I modified by editing index.tpl of the andrea06 theme . http://vetoweb.free.fr/

I'd want to integrate plogger, a gallery generator, into serendipity, so that the content of my blog is replaced by the plogger gallery when I click on the Photos tab (while still keeping the serendipity template (banner, left column, etc).
I know it's possible http://www.plogger.org/docs/config/#integration but I don't understand a single word to the documentation. They say I only need to add 3 lines, but I really don't understand where.
Can you help me please?
:?:

And what should I do if I create a new tab (I know how to do that lol), to make it display a message for instance, or a picture...

I'm sure those questions may sound like the ABC's for the blog experts, but it does sound really complicated for me! :oops:

thanx for helping!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Integrating different contents via tabs into serendipity

Post by garvinhicking »

Hi!

First of all, don't be ashamed! You already achieved a lot! :)

What you now need to do is this. Edit your template's index.tpl. This is some kind of "Controller" where you can output your content.

The place where your content would show up is at the place where it reads:

Code: Select all

{$CONTENT}</div></div>
This occurs twice in the andreas06 theme. The first one is the one you want to modify, since it is the one that outputs code when you are simply viewing the blog. The other position would be used when you view single entries.

So, now you want to show your plogger gallery at this point. So you insert this code just before the line, so that it reads this:

Code: Select all

{if $mypage == 'photos'}{$myphotos}{else}{$CONTENT}{/if}</div></div>
So, what we have added are two variables. The one is called $mypage and the other $myphotos. The IF-clause will check "Is this variable set?" and if it is, it will show the content of $myphotos. If it is not set it will show the usual blog content.

$mypage is a new variable that you need to set for a specific page, if you want to see that page - and $myphotos will be the variable which holds the content of your photo gallery.

Because these variables should only be set on the page where you view the photos, you need to add a new "subpage" to serendipity. You do this by setting the link of your "Photos" tab to a link like this:

Code: Select all

http://vetoweb.free.fr/index.php?serendipity[subpage]=photos
Now, this page uses the simple serendipity index file. You will now also tell serendipity somehow, that it should include your gallery.

You do that by editing the file "config.inc.php" inside your andreas06 template directory.

It currently looks like this:

Code: Select all

$probelang = dirname(__FILE__) . '/lang_' . $serendipity['lang'] . '.inc.php';
if (file_exists($probelang)) {
    include $probelang;
} else {
    include dirname(__FILE__) . '/lang_en.inc.php';
}

$serendipity['smarty']->assign('CONST', get_defined_constants());
but you will modify it to this:

Code: Select all

# Check if the plogger gallery is called
if ($serendipity['GET']['subpage'] == 'photos') {
    
    # Include plogger script. Put all output in $gallery.
    include('gallery.php');
    ob_start();
    the_gallery_head();
    the_gallery();
    $myphotos = ob_get_contents();
    ob_end_clean(;
    
    $serendipity['smarty']->assign('mypage', $serendipity['GET']['subpage']);
    $serendipity['smarty']->assign('myphotos', $myphotos);
}

$probelang = dirname(__FILE__) . '/lang_' . $serendipity['lang'] . '.inc.php';
if (file_exists($probelang)) {
    include $probelang;
} else {
    include dirname(__FILE__) . '/lang_en.inc.php';
}

$serendipity['smarty']->assign('CONST', get_defined_constants());
As you can see, I added a few lines at the top. Those check the URL parameters you passed on to the index.php file of serendipity, and if it detects the string 'photos' in that variable, it will include the plogger gallery and pipe all output into a variable that is then passed on to the index.tpl template file where it can be displayed.

Now have a try! :-)

The same will apply to any other new pages you might want to invent. The cycle is always the same:

1. Think of a new link to use (index.php?serendipity[subpage]=XXX)
2. Implement the output into index.tpl
3. Implement the "input" into your config.inc.php

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Bumble
Posts: 4
Joined: Fri Jul 21, 2006 8:44 pm

Post by Bumble »

Wow! :shock: Thanx a lot for the step by step explanation. :D Now I'm gonna read this over and over untill I get it! :lol: Never would I have known all this stuff by myself!

BTW, there's one thing I didn't understand. You said the cycle is always the same
1. Think of a new link to use (index.php?serendipity[subpage]=XXX)
2. Implement the output into index.tpl
3. Implement the "input" into your config.inc.php
If I want to show an html page I created, where do I have to save the page, and what is the code to add to config.inc.php?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!
If I want to show an html page I created, where do I have to save the page, and what is the code to add to config.inc.php?
If you want to show a normal HTML page you might simply use the "Static Page" plugin, which allows you to maintain pages like these? If you already have a static .html file, you might want to use the "Wrap URL / IFrame" plugin?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Bumble
Posts: 4
Joined: Fri Jul 21, 2006 8:44 pm

Post by Bumble »

garvinhicking wrote:Hi!
If I want to show an html page I created, where do I have to save the page, and what is the code to add to config.inc.php?
If you want to show a normal HTML page you might simply use the "Static Page" plugin, which allows you to maintain pages like these?

Best regards,
Garvin
Wow! Thank you so much, that is exactly what I needed. I created a "static page" with the plugin, and created a new tab that links to the static page into index.tpl, and now my tab links to the static page, while still keeping the serendipity blog layout! THANK YOU THANK YOU!

*now goes back trying to embed plogger thanx to the tutorial given*
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Perfect that this helped. :))

Have fun using Serendipity,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Bumble
Posts: 4
Joined: Fri Jul 21, 2006 8:44 pm

Post by Bumble »

after hours of trial and error, I finally managed to embed plogger. In fact it was easier than I thought. For an unknown reason, the modifications to configinc.php you gave me never worked...Finally the solution was in the plugins you gave me.

I used the wrap url plugin, and input the link to the index.php of plogger. And now it works.
wp_user
Regular
Posts: 8
Joined: Thu Jul 13, 2006 10:08 am

Post by wp_user »

First of all, thank you! :)
Plogger now shows up in my blog.

but...

The Links are incorrect.
plogger or s9y, I don't know, should produce something like:

Code: Select all

index.php?serendipity[subpage]=photos&level=collection&id=1
but the links look like this:

Code: Select all

index.php?level=collection&id=1
Because of this no images are shown and also all links referr to the start page of s9y.

I'm using plogger Beta 2.1 and the latest build of s9y, mod-rewrite is turned on for s9y, turned off for plogger.

plogger is installed in a subdirectory called plogger/ (so I include the script using include('plogger/gallery.php') )an I also tried to install it outside the s9y directory, but with no effect.

When I put serendipity[subpage]=photos& at the beginning of a link to an image i can see it.

Could you please give me a hint? Maybe I'm completely wrong and the serendipity[subpage]=photos& is not the problem, it's just a guess.

Thanks in advance! :)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Sadly, this would be a plogger issue. Please ask the creators on how to best append special links to a plogger link, so that you now where to insert the s9y subpage variable into.

Maybe the already have a config directive for that.

Best regard,s
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
wp_user
Regular
Posts: 8
Joined: Thu Jul 13, 2006 10:08 am

Post by wp_user »

garvinhicking wrote:Sadly, this would be a plogger issue. Please ask the creators on how to best append special links to a plogger link, so that you now where to insert the s9y subpage variable into.
Thanks again, Garvin.
Your support is amazing, I will take a closer look at your wishlist. :D

A little further question just to understand the whole thing.

I integrated plogger exactly like you described above. So, where is the issue? Could it be because of the template I'm using?
Or is it just because I'm using another version of plogger than your tutorial was build upon?

I'm a little confused because I've googled nearly the whole net and it seems like I'm the only person facing this problem.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!
Thanks again, Garvin.
Your support is amazing, I will take a closer look at your wishlist. :D
Thanks for that. :) Currently though, my paypal buttons would help me a lot more, because I need money for a new server :)
I integrated plogger exactly like you described above. So, where is the issue? Could it be because of the template I'm using?
Or is it just because I'm using another version of plogger than your tutorial was build upon?
The issue is because plogger is reponsible for giving you the links like index.php?XXX. Serendipity is not involved in that, so plogger needs to be made aware that serendipity needs a [subpage] variable to properly show a page. So plogger must add this variable for every link it spews out to you.

My basic idea was only how you embed foreign content; I really know nothing about plogger itself. :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
snowball
Posts: 1
Joined: Fri Jan 12, 2007 3:41 pm
Location: Kempen / Germany
Contact:

Post by snowball »

@wp_user

Did you get the answer for the plogger link problem?

I am having the same problem but can't get the solution :(

Could you give me a hint?

Thank you.

Jochen
wp_user
Regular
Posts: 8
Joined: Thu Jul 13, 2006 10:08 am

Post by wp_user »

snowball wrote:Did you get the answer for the plogger link problem?
No, I didn't get a solution. Instead of plogger I'm using the Picasa Plugin cause I don't really need a webbased admininterface to the gallery.

If you need a web based gallery you could use gallery2. There is a native s9y Plugin to integrate this gallery. It is called "Gallery2 Embed: gallery2".

Worked fine for me, but I liked Picasa more so... your decision. ;)

See you!
Message me! http://www.nicht-richtig.de/chat.html (Flash required)
Post Reply