NEW Plugin - If Homepage…
Posted: 04 July 2008 02:47 AM   [ Ignore ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6543
Joined  04-15-2006

EDIT - Add Actually the Ternary operation is working fine. I’m just too tired to realise that I was checking against false instead of true. All should work fine hopefully for everyone?

Okay a nice easy one this one in relation to this thread over here.

Please bear in mind that this was written in under 1 minute so hopefully it should do as it says on the tin wink I’m still a little confused as I swear that my ternary operator condition in the plugin is working back to front but it seems to be working on my system so hopefully it will elsewhere too. wink

Usage V1.0.2

{exp:if_homepage}

{if is_homepage}
<p>This is the home-page</p>
{if:else}
<p>This isn't the home-page</p>
{/if}

{/exp:if_homepage}


Usage V1.0.1

{exp:if_homepage}

{if true}
This is the home
-page
{if
:else}
This isn
't the home-page
{/if}

{/exp:if_homepage}


Usage V1.0

{exp:if_homepage}

{if fail}
This isn
't the home-page
{if:else}
This is the home-page
{/if}

{/exp:if_homepage}

That’s it basically. Hope it works for everyone and hope it’s of some use.

Best wishes,

Mark

File Attachments
pi.if_homepage.zip  (File Size: 2KB - Downloads: 63)
pi.if_homepage_V1.0.1.zip  (File Size: 2KB - Downloads: 65)
pi.if_homepage_V1.0.2.zip  (File Size: 2KB - Downloads: 82)
 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 04 July 2008 04:50 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  347
Joined  04-23-2008

Mark,

You’re a machine man! Simple, but useful.

 Signature 

Danny, your poor-man’s EE designer for hire/help.

Profile
 
 
Posted: 04 July 2008 05:03 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  246
Joined  04-12-2008

Hey Mark, well done, seems very useful.

Just a tiny remark: in terms of usability, it would make more sense if the syntax was:

{exp:if_homepage}

{if true}
    This is the homepage
{if
:else}
    This isn
't the homepage
{/if}

{/exp:if_homepage}

Or even

{if {exp:if_homepage}}
    This is the homepage
{if
:else}
    This isn
't the homepage
{/if}

Don’t know if the latter is possible in EE.

 Signature 

Designchuchi | Twitter

URL Field Extension
Required Category Extension
DC FreeForm GeoIP Extension

Profile
 
 
Posted: 04 July 2008 05:18 AM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6543
Joined  04-15-2006

Hiya,

You are absolutely right that I have the condition a bit upside down. Will look at that a bit later on and upload the new version. wink

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 04 July 2008 05:26 AM   [ Ignore ]   [ # 4 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6543
Joined  04-15-2006

Okay updated!

Hopefully should work. Let me know if I’ve done something wonky!!

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 04 July 2008 05:32 AM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  347
Joined  04-23-2008

Seriously Mark.. What kind of caffeine do you drink? You’re on here more than I am.. That’s INCREDIBLE.

 Signature 

Danny, your poor-man’s EE designer for hire/help.

Profile
 
 
Posted: 04 July 2008 05:49 AM   [ Ignore ]   [ # 6 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6543
Joined  04-15-2006

No caffeine for me. I’m strictly a soft drinks sort of guy. Fly helis so can’t afford to mess with my body too much! wink

Plus I hate the smell of coffee and other caffeine based products grin

Is it all working for everyone? The plugin I mean grin

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 06 July 2008 06:09 AM   [ Ignore ]   [ # 7 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6543
Joined  04-15-2006

Slight update to the plugin.

Now changed conditional to {if is_homepage} instead of {if true}. Hopefully this is a better fit?

Updated file in top post.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 13 July 2008 11:34 AM   [ Ignore ]   [ # 8 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1728
Joined  03-26-2006

For the record, the newest version is listed as 1.0.2, but the version number in the $plugin_info array still says 1.0.1.

And does every version note require an emoticon?

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 13 July 2008 11:49 AM   [ Ignore ]   [ # 9 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6543
Joined  04-15-2006

Hi Ryan,

Thanks for the heads up on the version number. The reason was that I made the swap between 1.0.1 and 1.0.2 quite close between each other and so basically forgot wink Fixed now though.

Not too sure what you mean by the emoticons though? Perhaps the ones in the plugin notes? Sorry if that is not the right thing to do? No offence was intended by it.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 14 July 2008 11:22 PM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  307
Joined  01-20-2006

Nice one mark. Just came across a great use for this.
And I *LOVE* that you’re keeping all version available in the parent. I wish more add-ons kept all versions available.

Anywho, good work.

I’d even think it’d be easier if you could create a global variable, only if you’re at the homepage.
So, do your query magic to see if you’re at the home page.
And then your code could be

{if mb_is_homepage}
TRUE
{if
:else}
FALSE
{
/if}


without needing the plugin syntax around it.

Anywho… just wishing… wishing up a star!

 Signature 

AJ Penninga
Pretty Squares, LLC - http://www.prettysquares.com

Profile
 
 
Posted: 15 July 2008 04:53 AM   [ Ignore ]   [ # 11 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6543
Joined  04-15-2006
AJP - 14 July 2008 11:22 PM

Nice one mark. Just came across a great use for this.

Excellent. Thanks for the kind words and glad that it has found some uses wink

AJP - 14 July 2008 11:22 PM

And I *LOVE* that you’re keeping all version available in the parent. I wish more add-ons kept all versions available.

Anywho, good work.

Yep like to keep everything in the one place making it easier for everyone to find what they are looking for.

AJP - 14 July 2008 11:22 PM

I’d even think it’d be easier if you could create a global variable, only if you’re at the homepage.
So, do your query magic to see if you’re at the home page.
And then your code could be

{if mb_is_homepage}
TRUE
{if
:else}
FALSE
{
/if}


without needing the plugin syntax around it.

Anywho… just wishing… wishing up a star!


Not too sure how I would go about doing that because as far as I know to use a plugin you have to have the surrounding plugin tags. Would be great if that could be done but I don’t know how that is possible.

Anyway glad you found a use for it.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 17 July 2008 11:55 AM   [ Ignore ]   [ # 12 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1728
Joined  03-26-2006

Just to note that this doesn’t work if you’re trying to use Google AdWords. My client has an incoming link like this from certain Google searches:

http://www.site.com/?gclid=CL_H2Jm5x5QCFSQyusyrNbeflg


Even though this is technically still the homepage, the plugin thinks this is not.

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64916 Total Logged-in Users: 23
Total Topics: 81870 Total Anonymous Users: 20
Total Replies: 440151 Total Guests: 180
Total Posts: 522021    
Members ( View Memberlist )