NEW Plugin - If Homepage…
Posted: 04 July 2008 03:47 AM   [ Ignore ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4899
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: 30)
pi.if_homepage_V1.0.1.zip  (File Size: 2KB - Downloads: 32)
pi.if_homepage_V1.0.2.zip  (File Size: 2KB - Downloads: 28)
 Signature 

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

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

Mark,

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

 Signature 

Now, if only I can combine my two favorite things in the world.. Transformers + ExpressionEngine = Nerd Nirvana

Note to self: I am not a nerd. I swear.

Profile
 
 
Posted: 04 July 2008 06:03 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  194
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

Profile
 
 
Posted: 04 July 2008 06:18 AM   [ Ignore ]   [ # 3 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4899
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!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 04 July 2008 06:26 AM   [ Ignore ]   [ # 4 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4899
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!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 04 July 2008 06:32 AM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  302
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 

Now, if only I can combine my two favorite things in the world.. Transformers + ExpressionEngine = Nerd Nirvana

Note to self: I am not a nerd. I swear.

Profile
 
 
Posted: 04 July 2008 06:49 AM   [ Ignore ]   [ # 6 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4899
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!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 06 July 2008 07:09 AM   [ Ignore ]   [ # 7 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4899
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!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 13 July 2008 12:34 PM   [ Ignore ]   [ # 8 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1455
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 DesignMember, EE Pro Network
Peruse my EE Plugins & Extensions

Profile
 
 
Posted: 13 July 2008 12:49 PM   [ Ignore ]   [ # 9 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4899
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!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 15 July 2008 12:22 AM   [ Ignore ]   [ # 10 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  289
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 05:53 AM   [ Ignore ]   [ # 11 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4899
Joined  04-15-2006
AJP - 15 July 2008 12:22 AM

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 - 15 July 2008 12:22 AM

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 - 15 July 2008 12:22 AM

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!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 17 July 2008 12:55 PM   [ Ignore ]   [ # 12 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1455
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 DesignMember, EE Pro Network
Peruse my EE Plugins & Extensions

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 10:33 AM
Total Registered Members: 60726 Total Logged-in Users: 17
Total Topics: 73184 Total Anonymous Users: 12
Total Replies: 394697 Total Guests: 511
Total Posts: 467881    
Members ( View Memberlist )