Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-02-22 01:33:45

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

jdw_if_ajax: serve and hide content

The plugin is available here.

Since dub_if_ajax is no longer up for grabs: here’s jdw_if_ajax . This plugin is based off dub_if_ajax (no longer available) by Jamie Wilkinson. It uses the x-requested-with header to deliver different content to Ajax calls.

Addition of a new tag: jdw_if_not_ajax.

jdw_if_ajax

Container tag. When the page or form is requested by ajax, content will show.

<txp:jdw_if_ajax>
// code for ajax goes here
<txp:else />
//other code goes here
</txp:jdw_if_ajax>

jdw_if_not_ajax

Container tag. When the page or form is requested by ajax, content won’t show.

<txp:jdw_if_not_ajax>
// skipped by ajax
</txp:jdw_if_not_ajax>

download jdw_if_ajax here

Last edited by colak (2015-11-11 17:20:49)


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#2 2010-02-22 09:13:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,447
Website GitHub

Re: jdw_if_ajax: serve and hide content

JanDW wrote:

Addition of a new tag: jdw_if_not_ajax.

Nice, thanks. I wondered when someone was going to update the original plugin. The addition of the not case is much more useful than it seems on the surface, so thanks for that too.

When I wrote smd_ajax a couple of years ago — designed as a complete AJAX implementation for delivering TXP articles — I also put the same ‘not’ case in and found myself using it almost exclusively during site development. I think my plugin’s only in use on one site on the Internet as I never officially released it due to a jQuery bug on IE and the fact I couldn’t get the history to work properly. Hmmm, perhaps I should revisit it now they’ve fixed at least one of those two issues…


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2010-02-22 10:16:19

jelle
Member
Registered: 2006-06-07
Posts: 165

Re: jdw_if_ajax: serve and hide content

Bloke wrote:

Hmmm, perhaps I should revisit it now they’ve fixed at least one of those two issues…

ooohhh….yes please.

Offline

#4 2010-02-22 16:23:53

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: jdw_if_ajax: serve and hide content

bring ‘er on, I say!

Last edited by JanDW (2010-02-22 16:24:17)


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#5 2010-03-22 12:20:29

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: jdw_if_ajax: serve and hide content

Excellent Thanks !
As Stef says the <txp:jdw_if_not_ajax> case is very useful !


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#6 2010-03-22 13:11:40

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: jdw_if_ajax: serve and hide content

Cheers, Guillaume, glad you’re finding it useful.


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#7 2010-03-22 13:41:15

hablablow
Member
From: Paris
Registered: 2004-12-13
Posts: 309
Website

Re: jdw_if_ajax: serve and hide content

Jan, when serving, in a page template (pages tab) the:

<txp:jdw_if_ajax>
call_this_form
<txp:else />
call_the_whole_page
<jdw_if_ajax>

Outputs a blank page :(

Last edited by hablablow (2010-03-22 13:42:17)


_
_I plant seeds for future visions. Farmer of your eyes. Subliminal engineer of your minds. eion founder__

Hablablow + Webdesignofficina

Offline

#8 2010-03-22 13:43:57

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: jdw_if_ajax: serve and hide content

You’ve omitted </txp: in the closing tag for </txp:jdw_if_ajax>, is that it?

edit: Ahh, so have I in the example up top, it seems, lemme fix that fixed.

Last edited by JanDW (2010-03-22 13:47:50)


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#9 2010-03-22 14:09:21

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: jdw_if_ajax: serve and hide content

Also @Bloke

…the fact I couldn’t get the history to work properly

Could this or this help?

Last edited by JanDW (2010-03-22 14:09:36)


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#10 2010-03-27 21:20:52

sereal
Member
From: Indonesia
Registered: 2010-02-18
Posts: 55

Re: jdw_if_ajax: serve and hide content

is this plugin able to wrap the Comments Form ?
I’m looking for the way to make the Comments Form loads on a single DIV instead reload the whole page when the users clicking preview / submit button.

is that possible ?

please advise

thanks


$(mydocument).notyetready(function() {});
dowebsitesneedtolookexactlythesameineverybrowser ?

Offline

#11 2015-11-11 14:37:23

dorka
Member
Registered: 2012-10-04
Posts: 90

Re: jdw_if_ajax: serve and hide content

Hi there, the link to this usefull plugin is broken. Could someone, please, share a copy?
Thanks!

Offline

#12 2015-11-11 14:52:51

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: jdw_if_ajax: serve and hide content

dorka wrote #296542:

Hi there, the link to this usefull plugin is broken. Could someone, please, share a copy?
Thanks!

I recovered a copy from the Wayback Machine.

Offline

Board footer

Powered by FluxBB