Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-11-15 06:34:16

mhulse
Plugin Author
From: Eugene Oregon
Registered: 2005-01-21
Posts: 200

jQuery .load() <txp:article />

Hi,

I am just goofing around with jQuery and XMLHTTPrequest’s.

So far, I can load a url, no problem… but that brings-in all the page content… All I want is the data from the <txp:article /> tag, but I am not sure of the best way to use that tag in conjunction with .load().

Any ideas on how I could skip loading the wrapper template, and just pull-in the article data?

I would love some help… Tips? Ideas? Thoughts?

Many thanks in advance!
Cheers,
Micky

Offline

#2 2007-11-15 07:17:20

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: jQuery .load() <txp:article />

I’ve done a similar thing, although on the admin side, with my wet_quicklink plugin. It employs a companion plugin named wet_peex, which accepts a client request and returns various properties of a subset of articles (AJAX, as they happen to call it…).

You might have some fun poking through it and porting it to the public side. I never tried because I never went through all the security and privacy implications.

Offline

#3 2007-11-15 07:31:07

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: jQuery .load() <txp:article />

Another idea: Add a special request parameter to the URI (?foo=1) and change your page template to exclude all but the desired content when this URL parameter exists. chs_if_url_var comes handy.

Offline

#4 2007-11-15 07:53:34

mhulse
Plugin Author
From: Eugene Oregon
Registered: 2005-01-21
Posts: 200

Re: jQuery .load() <txp:article />

Hi Robert, many thanks for you quick reply, I really appreciate your help. :)

Great ideas too! Thanks for the tips. Looking over you plugin(s) now.

Hehe, I will probably be back with more questions… If nothing else, I will post my findings and/or end results.

Thanks again! :D

Cheers,
Micky

Offline

#5 2007-11-15 23:55:01

mhulse
Plugin Author
From: Eugene Oregon
Registered: 2005-01-21
Posts: 200

Re: jQuery .load() <txp:article />

Hey Robert! Many thanks for your help on this one. Your ideas really got me going in the right direction.

I ended up using the <dub_if_ajax> (link) plugin to only show the <txp:article /> and <txp:older /> / <txp:newer /> tags.

I am sure chs_if_url_var would work just as good… In fact, I will be using that to do many other things.

Man, I sure do love the flexibility of Textpattern.

Thanks a billion Robert!

Cheers,
Micky

Offline

#6 2007-11-16 01:25:18

giz
Member
From: New Zealand
Registered: 2004-07-26
Posts: 299
Website GitHub Twitter

Re: jQuery .load() <txp:article />

http://docs.jquery.com/Release:jQuery_1.2

Partial .load() allows you to load chunks of HTML documents into your page, filtered by a jQuery selector. This works just like a normal Ajax .load(), but you just specify a selector immediately following the URL that you’re retrieving.

Offline

#7 2007-11-16 03:37:20

mhulse
Plugin Author
From: Eugene Oregon
Registered: 2005-01-21
Posts: 200

Re: jQuery .load() <txp:article />

Hey Gary, thanks for the tip! That is pretty cool. :D

I will be playing with that approach, I can’t believe I did not read about partial load in the new jQuery book.

Thanks again. Have a great day/night.
Cheers,
Micky

Offline

Board footer

Powered by FluxBB