Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-26-2011, 12:13 AM   PM User | #1
turpentyne
Regular Coder

 
Join Date: Aug 2010
Posts: 312
Thanks: 10
Thanked 1 Time in 1 Post
turpentyne is an unknown quantity at this point
javascript to search one page for a file path to put on another.

I'm working on a site built through Squarespace, and I've run into some limitations. They've told me it's possible to build a Javascript to pull specific images from one page's journal entries and place them (with links to the entry) on other pages.

Can somebody send me in the right direction on how I would do this? Basically I want to find a most recent posting tagged with a specific category, find the file file path of it's related image, and make that appear on the page that my javascript is on.
turpentyne is offline   Reply With Quote
Old 08-26-2011, 12:20 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,247
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
This only possible if both pages are coming from the same domain. That is, if both pages are served up by the same web server (or at least server group).

If it is, then it's not hard. But...

-- Are both pages visible at the same time? That is, is one a popup from the other?
-- If so, which page opened the other one?

If only one page is to be visible, then the easiest way to do this is to load the other page into an invisible <iframe> on the visible page and then search for the desired content within the HTML of the invisible <iframe>.

In any case, we need to know *HOW* the "most recent posting [is] tagged with a specific category". That is, what does the HTML that makes this obvious look like?
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote
Old 08-26-2011, 06:32 PM   PM User | #3
turpentyne
Regular Coder

 
Join Date: Aug 2010
Posts: 312
Thanks: 10
Thanked 1 Time in 1 Post
turpentyne is an unknown quantity at this point
Both pages are on the same domain. I was thinking I could have the first page load quickly, or hidden, then pull the info and pass the info to a second page. But <iframe> might make more sense - if it's possible with the cms program my client is using (Squarespace).

Basically I'm building a page that's pulling rss feeds from individual pages on the same domain (built that way due to a limitation of the cms software the client is using) I want to detect the most recent post for each category, and pull the thumbnail picture to appear here, as the layout suggests: http://www.frontdoorsnews.com/-4/

An example of the pages I want to pull the pic url from is here: http://frontdoorsnews.squarespace.com/from_the_heart/

On this page, a specific div tag (div id="item12616108") matches the category. I could rebuild it to have divs for all the categories.

Inside that div is another div class called "journal-entry-float-day". I can change that to include hour and minute, so it can be used to find the most recent post.

Buried a couple div's down is an image. There will only be one per post, so maybe this is my method? Let me know if this theory works, and give some suggestions on scripting this? I'm a little bit new to javascript building.

Hope I'm on the right path!

Last edited by turpentyne; 08-26-2011 at 06:51 PM..
turpentyne is offline   Reply With Quote
Old 08-26-2011, 09:03 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,247
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Seems you have found the right idea, judging by your other thread that I have replied to. If not, ask again.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:17 AM.


Advertisement
Log in to turn off these ads.