External PHP Application

Creating and modifying plugins.
d_cee
Regular
Posts: 603
Joined: Wed Jan 18, 2006 6:32 pm
Location: UK
Contact:

External PHP Application

Post by d_cee »

I'm using the 'External PHP Application' plugin to display a gallery and I'd like to assign a category to the page. Is this possible?

Cheers

Dave
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: External PHP Application

Post by garvinhicking »

Hi!

What would you like to achieve with that? Only entries can be assigned to categories, actually...

But if you tell me what you want to do with that, I might be able to tell you how to solve it differently :)

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/
d_cee
Regular
Posts: 603
Joined: Wed Jan 18, 2006 6:32 pm
Location: UK
Contact:

Re: External PHP Application

Post by d_cee »

Hi Garvin
garvinhicking wrote:Hi!
What would you like to achieve with that? Only entries can be assigned to categories, actually...

But if you tell me what you want to do with that, I might be able to tell you how to solve it differently :)
I'm using the sidebar hider to display a link of links (HTML nugget) when somebody clicks on the portfolio section of my website - the sidebar links are all different sections of the portfolio that use an external PHP gallery application. Because I can't allocate a category to the external PHP gallery pages the links are hidden again when the portfolio is being viewed. I'd like the links to be visible.

I hope that's clear :?
thanks
Dave
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: External PHP Application

Post by garvinhicking »

Hi!

Ah. I see.

Well, the short answer: It's not possible without much coding effort.

But the longer and more good answer: You can achieve it by editing your sidebar.tpl template file.

The you can add an IF-Statement like:

Code: Select all

{if $item.title == 'Your title of the HTML nugget' && $staticpage_pagetitle != 'Your title of the external app'}
...show the plugin
{else}
...show nothing
{/if}
A tad dirty, but it works fast at last. :)

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/
d_cee
Regular
Posts: 603
Joined: Wed Jan 18, 2006 6:32 pm
Location: UK
Contact:

Post by d_cee »

Hi Garvin

I'd love to have made this work without coming back but I just couldn't :-(
my sidebar.tpl now looks like this

Code: Select all

{if $is_raw_mode}
<div id="serendipity{$pluginside}SideBar">
{/if}
{foreach from=$plugindata item=item}
    <div class="serendipitySideBarItem container_{$item.class}">
        {if $item.title != ""}<h2 class="serendipitySideBarTitle {$item.class}">{$item.title}</h2>{/if}
        {if $item.title == 'Portfolio Links' && $staticpage_pagetitle != 'gallery.html'}
<h2 class="serendipitySideBarTitle {$item.class}">{$item.title}</h2>{/if}
        <div class="serendipitySideBarContent">{$item.content}</div>
    </div>
{/foreach}
{if $is_raw_mode}
</div>
{/if}
permalink: /pages/gallery.html
my url shorthand name: 'Portfolio - design for print'
html nugget: Portfolio Links

so I'm guessing I've done something wrong

cheers - and thanks
Dave
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Hm, try this instead:

Code: Select all

{if $is_raw_mode}
<div id="serendipity{$pluginside}SideBar">
{/if}
{foreach from=$plugindata item=item}
    <div class="serendipitySideBarItem container_{$item.class}">
        {if $item.title != ""}<h2 class="serendipitySideBarTitle {$item.class}">{$item.title}</h2>{/if}

        {if $item.title == 'Portfolio Links' AND $staticpage_pagetitle == 'gallery.html'}
        <div class="serendipitySideBarContent">This Nugget is hidden, because Portfolio Links are not visible in the gallery.</div>
        {else}
        <div class="serendipitySideBarContent">{$item.content}</div>
        {/if}
    </div>
{/foreach}
{if $is_raw_mode}
</div>
{/if}
I added some verbose text which you might want to remove when it works ;)

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/
d_cee
Regular
Posts: 603
Joined: Wed Jan 18, 2006 6:32 pm
Location: UK
Contact:

Post by d_cee »

Hi Garvin

hmmm - my sidebar now looks like this screenshot and, unfortunately I still don't have my HTML nugget showing

cheers

dave
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Uh, that's weird. I wouldn't know where those "?" are coming from. Can you show me the URL to that, so that I could have a look at the HTML output?

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/
d_cee
Regular
Posts: 603
Joined: Wed Jan 18, 2006 6:32 pm
Location: UK
Contact:

Post by d_cee »

Hi Garvin

I guessed that wasn't supposed to happen ;-)
the url is http://bankcreative.com

thanks

dave
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I'd say you did a bad copy+paste of the code or saved the file in UTF-16 Format inproperly? Try to do it again and save the file in ASCII/ANSI mode?

However, you will need to also set the HTML Nugget to display on all pages/categories now. You cannot restrict it to a category using the sidebarhider plugin anymore; you will need to exclude this plugin via the .tpl file.

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/
d_cee
Regular
Posts: 603
Joined: Wed Jan 18, 2006 6:32 pm
Location: UK
Contact:

Post by d_cee »

Hi Garvin
don't know what we'd do without you :-)
garvinhicking wrote:I'd say you did a bad copy+paste of the code or saved the file in UTF-16 Format inproperly? Try to do it again and save the file in ASCII/ANSI mode?
Thanks - it's great now :oops:
you will need to exclude this plugin via the .tpl file.
how do I do that? I tried

Code: Select all

        {if $item.title != "" AND $categories != 'portfolio' }<h2 class="serendipitySideBarTitle {$item.class}">{$item.title}</h2>{/if}
but it didn't work of course. Maybe I should stick to CSS?

cheers
Dave
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I think you cannot use $categories, I don't think this variable is declared. You might need to check a categoryid variable; please have a look in the variable documentation on www.s9y.org? Apart frmo that the check you did is the right direction :)

But you must pay attention where you add this if() check, because you are currently putting it into the if-clause of the item.title output. But what you want is to block the output if item.content instead (like in the code snippet I gave you) :)

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/
d_cee
Regular
Posts: 603
Joined: Wed Jan 18, 2006 6:32 pm
Location: UK
Contact:

Post by d_cee »

Thanks Garvin

I'll try and sort it out tonight as I'm off home now. With a bit of luck and a fair wind I won't need to bother you again - he says hopefully :-)

cheers

Dave
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

No problem, just have a try. If you don't manage anything, just come back here next week with your latest code version, and we'll sort it out together. :)

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/
d_cee
Regular
Posts: 603
Joined: Wed Jan 18, 2006 6:32 pm
Location: UK
Contact:

Post by d_cee »

Hi Garvin

I got close but no cigar! My sidebar.tpl now looks like

Code: Select all

{foreach from=$plugindata item=item}
    <div class="serendipitySideBarItem container_{$item.class}">
    {if $category_info.categoryid != '2' AND $item.title == 'Portfolio Links'}
    <h2 class="serendipitySideBarTitle {$item.class}">{$item.title}</h2>
    <a href="#">click here to go to our portfolio</a>
    {else}
        {if $item.title != "" }<h2 class="serendipitySideBarTitle {$item.class}">{$item.title}</h2>{/if}
        {if $item.title == 'Portfolio Links' AND $staticpage_pagetitle == 'gallery.html' }
        <div class="serendipitySideBarContent">This Nugget is hidden, because Portfolio Links are not visible in the gallery.</div>
        {else}
        <div class="serendipitySideBarContent">{$item.content}</div>
        {/if}
        {/if}
    </div>
{/foreach}
{if $is_raw_mode}
</div>
{/if}
which is great - it shows the link list in the portfolio section. Unfortunately it no longer shows the links on the gallery pages with the embedded application. I tried every variation of his code I could think of hoping not to be back here this morning, but here I am.

cheers

Dave
Post Reply