This following refers to the file "job_posting.module" and I'm trying to change the fields displayed on the job listing page.
Within the function job_posting_list_nodes() for each database record retrieved info is added to the $listings variable.
I understand this is done by node_view() as shown in the code below.
while ($item = db_fetch_object($result)) { $listings .= node_view(node_load($item->nid), TRUE); } </pre>However, I'm trying to work out how to change the fields returned? I believe
node_load($item->nid)gets all fields for the given node ID. But how do you change the fields returned by node_view?For example, what makes the "Employer name" be displayed on the listing but not the "URL" or "Contact"?
Further, I can get the teaser to appear in the listing as follows but I'm sure this is not the right way.
while ($item = db_fetch_object($result)) { $listings .= node_view(node_load($item->nid), TRUE); //** Two lines below added as demonstration $temp = node_load($item->nid); $listings .= $temp->teaser; } </pre>
Comments
Comment #1
mikee commentedI would just like to add thanks for this great module!
Comment #2
gmarus commentedYou're probably making this more complicated than you need to. Examine the templates (job-posting-node.tpl.php and job-posting-list.tpl.php) and it should become clear. HTH.
Comment #3
gmarus commented...oh, and possibly, the 'preprocess' functions in job_posting.module as well.
Comment #4
mikee commentedHi gmarus,
Thanks so much!
I'm a Drupal novice and had incorrectly assumed that:
However, I now realise "job-posting-node.tpl.php" handles which fields are displayed on both pages and the $page variable is used within "job-posting-node.tpl.php" to determine which additional fields to display on the detailed job page.
Further, by adding a line to the function template_preprocess_job_posting_node_display(&$variables) within the job_posting.module as below:
Comment #5
gmarus commented