I've got version ed_classifieds 5.x-1.5-5 on Drupal 5.1 with gmap running. My issue is the location text appears before, i.e above the ad content. Cosmetically and from a readability standpoint I would like the ad itself to appear first with the location below it How would I do that?

CommentFileSizeAuthor
#6 respect_weight.patch554 bytesbinford2k

Comments

mcurry’s picture

Project: Classified Ads » Location
Version: 5.x-1.5-5 » 5.x-1.x-dev
Component: Miscellaneous » User interface

Since ed_classified doesn't provide location information, I assume that you are using location.module. The placement of the location information is controlled by the location module 'weight' settings for the classified ads content type.

You need to set the "Locative Information" under /admin/content/types/ed-classified - you will see a collapsible field set with settings for the Location module specific to the 'classified' content type. In that collapsible field set, you can change the 'weight' of the location information to a higher number, for example, 8, which will place the location information at the bottom.

I haven't tested this on Drupal 5 version of the classified ads module.

jodo’s picture

Thanks for your prompt reply. I had the location weight set to 9. Perhaps I need to clarify my problem.
After posting an ad with a location the output/appearance of the ad is:
Title
post date
Location(s)
Name
Street
City
Country
See google maps

Buy my trick pony....ad content

I want the ad content on top with the Location(s) etc below.

Again, thanks for your quick response and for your fine module.

mcurry’s picture

I'm sorry, I'm not quite sure what you are asking for. Can you post a URL so we can see what you are talking about?

Here are examples of the results I get with the location module when used with classified ads - on Drupal 4.7:

(drill down; posting indirect links, ads expire but links from drupal.org don't)

mcurry’s picture

Project: Location » Classified Ads
Version: 5.x-1.x-dev » 5.x-1.5-5

Another question: what happens when you use the location module / gmap with other node types (book page, story, page, blog, etc.) Same or different results?

Please post a URL or email it to me: exodusdev [at] gmail.com

mcurry’s picture

Title: Location text in top position of ad. Want it to appear in bottom. » Respect per-content-type weight settings when rendering location data in hook_nodeapi
Project: Classified Ads » Location
Version: 5.x-1.5-5 » 5.x-1.x-dev
Category: support » feature

After a quick inspection of the location module hook_nodeapi() view: section, it appears that the location module does not use the 'weight' setting when rendering the location content, thus making it impossible to control the placement of the 'Location(s)' block within the rendered node content.

In Drupal 4.7 version, it always appended the content to the end of the existing content, so the module weight could be used to control rendering.

Is there another way to control the 'Location(s)' block placement in the rendered node content?

I think that the locations module should set the '#weight' value in the rendered content in Drupal 5. Something like this should do the trick: (Note: I've not tested this, so I'm not sure if the code is correct).

            $node->content['locations']['#value'] .= '<h3>'. t('Location(s)') .'</h3>'. $themed_locations;
            $node->content['locations']['#weight'] = variable_get('location_weight_'. $node->type, 9);

See: http://drupal.org/node/64279#node-view

As with FormAPI arrays, the #weight property can be used to control the relative positions of added elements. This replaces the old method of appending or prepending text to $node->body.

binford2k’s picture

Status: Active » Needs review
StatusFileSize
new554 bytes

patch for solution suggested above. It works for me.

ray007’s picture

Category: feature » bug

*Bump*

I think the added line should be a few lines lower before the closing bracket of if (variable_get('location_display_location', 1)) { ..., but a fix like this is needed.

My current diff would look like this:

diff --git a/location.module b/location.module
index 91261f8..8871d3c 100644
--- a/location.module
+++ b/location.module
@@ -1142,6 +1147,7 @@ function location_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
             //drupal_set_html_head(location_geocode_meta_tags($node->location));
           //}
         }
+        $node->content['locations']['#weight'] = variable_get('location_weight_'. $node->type, 9);
       }
 
       if (variable_get('location_addanother_'. $node->type, 0) && count($node->locations) < variable_get('location_maxnum_'. $node->type, 0) && !$teaser && node_access('update', $node)) {

And I think setting the weight there is fixing a bug, not a new feature.

scottrigby’s picture

sorry - I solved my problem (is there a way to delete posts?).
anyway, this is solved in the content type not through managing the fields but in the "Edit" tab, then "Locative information", then set weight.

Don't know why this isn't just editable in the "manage fields" section. However, it works.

bdragon’s picture

Status: Needs review » Closed (duplicate)

Marking as duplicate of http://drupal.org/node/47831.

Please followup there.

Thanks.

end user’s picture

Version: 5.x-1.x-dev » 5.x-3.x-dev

Having the same problem with D5.11 and Location 5.x-3.0-rc1 and 5.x-3.0-dev and also with D6