Mix cck, html, php

paulwamail - November 14, 2008 - 04:10
Project:Magic Tabs
Version:5.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Do you have an example on how to use full html and cck fields together. I have a contemplate page with html, tables, javascript, php, etc and would like to split it onto four tabs. I don't know to format all this after the 'content' => part of my tab module.

Thank you

#1

paulwamail - November 15, 2008 - 06:59
Title:full html and cck field mix» I should clarify my problem

To help to get an answer sooner maybe I should clarify my problem. I guess what I am wanting to know is how to load a .php file using magic tabs. The magic tabs call would be placed in my cck contemplate and I would just cut and past my existing contemplate code and split it into 4 php files. My current cck contemplate contains a mix of html, javascript (a custom google map api) and php code (to display cck fields, views and call a weather api) I am very weak at php. Would I have to redo the way I pass variables and css do to being contained within a tab.

The code below is what I have in my module so far. The lake details is also why I posted the need to force the first tab to always default to active. I guess you are working on this issue already.

Thank you for your help.

<?php
function lake_layout_magic_tabs($active = 0) {
  if (arg(0) == 'node' && is_numeric(arg(1))) {
    $node = node_load(arg(1));
    node_build_content($node);
  }

  $tabs[] = array(
    'title' => t('Lake Details'),
    'content' => t('Load a php file with my code... Will show the details for the lake.'),
  );
  $tabs[] = array(
    'title' => t('Lake Weather'),
    'content' => t('Load a php file with my codeWill show extended weather forcasts and alerts'),
  );
  $tabs[] = array(
    'title' => t('Interactive Map'),
    'content' => t('Load a php file with my code...Will show Google map with parks, campgrounds, lake access and boat ramps'),
  );
    $tabs[] = array(
    'title' => t('Parks/Campgrouds'),
    'content' => t('Load a php file with my code...Will show a listing of parks and campgrounds near this lake'),
  );
    $tabs[] = array(
    'title' => t('Lake Access/Boat Ramps'),
    'content' => t('Load a php file with my code...Will show a listing of lake access and boat ramps for this lake'),
  );
  return $tabs;
}

#2

paulwamail - November 16, 2008 - 18:18
Title:I should clarify my problem» Mix cck, html, php

I think I figured most of this out. Not the external file part (didn't try yet), but the mixed stuff. Didn't get an answer so I just kept playing around for a couple of days.

I didn't know that you had to use the cck fields like this t('<h2>Test</h2>' . $node->field_access_image[0]['view'] . 'end test');

#3

yhager - November 16, 2008 - 18:15

Sorry abou not responding, I am having very limited time at the moment to keep up with the issue queue. I'm getting to all issues eventually..
re forcing the first tab - different people have different needs, so I'm planning to add a variable to keep everybody happy...

 
 

Drupal is a registered trademark of Dries Buytaert.