[Pro] targeting a divs contents and placing it in another using php

Hi Everyone just a thought
is there a way to target a specific div using php and then dumping that content into another div on a different page
A bit like an includes but I want php to look at the page and extract the contents from that one specific div.

I have an example working using Jquery and it works perfectly but alas its a client side includes and I really want this to happen server side.

Anyway any thoughts on how to achieve this or an alternative method would be very much appreciated.

All the best max

ps if anyone whats the jquery version then let me know and I will send the freeway artwork across.

all the best max


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sure. I did this for another Freeway user last year. You need http://sourceforge.net/projects/simplehtmldom/ and then you simply get the content using the tools in that system. You can open a local (or remote, if your server has that allowed) file with file_get_html($path) and then you can crawl through that page using jQuery-like syntax, grab an element or do find-and-replace within it.

The only trick is that if you want to do multiple things to a document, you need to use a callback function, and sadly, you aren’t allowed to register multiple callbacks so you have to put all of your transformations into a single function rather than splitting them out into multiple (simpler, easier to test) individual functions.

Walter

On Apr 19, 2012, at 12:30 PM, max wrote:

Hi Everyone just a thought
is there a way to target a specific div using php and then dumping that content into another div on a different page
A bit like an includes but I want php to look at the page and extract the contents from that one specific div.

I have an example working using Jquery and it works perfectly but alas its a client side includes and I really want this to happen server side.

Anyway any thoughts on how to achieve this or an alternative method would be very much appreciated.

All the best max

ps if anyone whats the jquery version then let me know and I will send the freeway artwork across.

all the best max


actionsdev mailing list
email@hidden
Update your subscriptions at:
List Options | FreewayTalk


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

At 12:30 -0400 19/4/12, max wrote:

Hi Everyone just a thought
is there a way to target a specific div using php and then dumping
that content into another div on a different page
A bit like an includes but I want php to look at the page and
extract the contents from that one specific div.

I have an example working using Jquery and it works perfectly but
alas its a client side includes and I really want this to happen
server side.

Anyway any thoughts on how to achieve this or an alternative method
would be very much appreciated.

All the best max

ps if anyone whats the jquery version then let me know and I will
send the freeway artwork across.

I sounds as if both pages are yours and on the same site.

If you create that div in its own page with the ?PHP include? action
applied, you can include that ‘page’ into both your real pages.

If that’s what you mean Š

David


David Ledger - Freelance Unix Sysadmin in the UK.
HP-UX specialist of hpUG technical user group (www.hpug.org.uk)
email@hidden
www.ivdcs.co.uk


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On Apr 20, 2012, at 3:45 AM, David Ledger wrote:

At 12:30 -0400 19/4/12, max wrote:

Hi Everyone just a thought
is there a way to target a specific div using php and then dumping that content into another div on a different page
A bit like an includes but I want php to look at the page and extract the contents from that one specific div.

I have an example working using Jquery and it works perfectly but alas its a client side includes and I really want this to happen server side.

Anyway any thoughts on how to achieve this or an alternative method would be very much appreciated.

All the best max

ps if anyone whats the jquery version then let me know and I will send the freeway artwork across.

I sounds as if both pages are yours and on the same site.

If you create that div in its own page with the ?PHP include? action applied, you can include that ‘page’ into both your real pages.

If that’s what you mean Š

I think he’s more concerned with walking the included page’s DOM and plucking an individual tag out of it, along with its children.

Walter

David


David Ledger - Freelance Unix Sysadmin in the UK.
HP-UX specialist of hpUG technical user group (www.hpug.org.uk)
email@hidden
www.ivdcs.co.uk


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi walter thats what I was looking for cheers

kind regards max


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options