14 Posts
Jack Horner
10 years ago
Topic

Setup:

Joomla! 3.1.1
Seblod 3.1.1
seb_html 1.0


I am trying to use the seb_html template to (hopefully) generate clean markup. what little I see in documentation suggests that I should simply be able to add my Markup to the HTML field in Template option of the Content view. I can add HTML, but when I attempt to add Seblod variables like as found in the v2 documentation .


I've tried several ways to do this and I am stymied. What I am I doing wrong?



What I expect:



What I'm doing: 



What I get:

Get a VIP membership
10 years ago
3
Level 1

Hi Jack,

The template HTML is exactly the same thing of the plugin typo HTML. That's mean you don't need to put php tag. So remove your <?php echo and keep only your $cck->getText('your_field') :

exemple 01:

<div>

	<a href="/$cck->getLink('your_field')">

		<span class="label">$cck->getLabel('your_field') :</span>

		<span class="value">$cck->getValue('your_field')</span>

	</a>

</div>

exemple 02:

<div>

	<a href="/$cck->getLink('your_field')">

		<img src="/$cck->getThumb2('your_field_image')"/>

	</a>

</div>

Best regards.


14 Posts
Jack Horner
10 years ago
2
Level 2

Hmmm,   well, at least I'm getting something.

I adapted example 1:

<div>

     <span class="label">$cck->getLabel('msb_dateline'):</span>

     <span class="value">$cck->getField('msb_dateline')</span>

</div>






 But I can only pull the label, not the value.

Could I be storing this value incorrectly?



14 Posts
Jack Horner
10 years ago
0
Level 3

ok, I figured it out for myself.. a bit.

I looked up the various bits that can be retrieved bits in this post: http://www.seblod.com/v2/fo...

Of all the variables referenced in this post only the following work: 

$cck->getLabel('myField')

$cck->getValue('myField')




These others don't seem to work (or I dont know what I'm doing with them):

$cck->getField('myField')   btw, does this replace $cck->renderField('myField')?

$cck->getTypo('myField')

$cck->getHtml('myField')

$cck->getText('myField')











10 years ago
0
Level 3

Hi Jack,

It s true, i make a mistake, sorry it's not getField but getValue.

And yes, others work! How?

getTypo, only if you use a typo plug-in on your field ( bouton 3 ).

getText, only if you use something like that inside a radio button : mytext=myvalue.

getHtml is the samething of renderField without the markup.

The renderField is the markup. Inside the markup, you have the getLabel and the getValue  like that :

// The markup around each field (label+value/form) can be Overridden.
// Remove the underscore [_] from the Filename. (filename = markup.php)
// Edit the function name:
//   - fields/markup.php        =>   cckMarkup_[template]
//   - fields/[contenttype]/markup.php   =>   cckMarkup_[template]_[contenttype]
//   - fields/[searchtype]/markup.php   =>   cckMarkup_[template]_[searchtype]
// Write your Custom Markup code. (see default markup below)

// cckMarkup
function cckMarkup_seb_one( $cck, $html, $field, $options )
{
   $desc   =   '';
   if ( $cck->getStyleParam( 'field_description', 0 ) ) {
     $desc   =   ( $field->description != '' ) ? '<div id="'.$cck->id.'_desc_'.$field->name.'" class="cck_desc cck_desc_'.$field->type.'">'.$field->description.'</div>' : '';
   }
   
   $label   =   '';
   if ( $options->get( 'field_label', $cck->getStyleParam( 'field_label', 1 ) ) ) {
     $label   =   $cck->getLabel( $field->name, true, ( $field->required ? '*' : '' ) );
     $label   =   ( $label != '' ) ? '<div id="'.$cck->id.'_label_'.$field->name.'" class="cck_label cck_label_'.$field->type.'">'.$label.'</div>' : '';
   }
   
   $html   =   '<div id="'.$cck->id.'_'.$cck->mode_property.'_'.$field->name.'" class="cck_'.$cck->mode_property.' cck_'.$cck->mode_property.'_'.$field->type.'">'.$html.'</div>';
   $html   =   '<div id="'.$cck->id.'_'.$field->name.'" class="cck_'.$cck->mode.'s cck_'.$cck->client.' cck_'.$field->type.' cck_'.$field->name.'">'.$label.$html.$desc.'</div>';
   
   return $html;
}
?>
10 years ago
1
Level 1

Same here. Can't get the template to work. But my output is different - it is just the chunk of the text of php code ("<?php" gets cut off and the rest is shown). Could someone please post a working example of the code to put in the html template?

332 Posts
Kenneth
10 years ago
0
Level 2
Did you ever find out about this?

To bad the documentation is lacking around this great system.
147 Posts
MtnPavlas
9 years ago
1
Level 1
Hey guys, so is it not possible to use the renderField variable in the HTML template? I'm unable to get results. When I try using it, it displays verbatim (i.e. "$cck->renderField('my_field')"
693 Posts
rpoy
9 years ago
0
Level 2
Hi MtnPavlas,

Have you tried $cck->getValue('my_field');

thanks,

Randy
147 Posts
MtnPavlas
9 years ago
0
Level 1
Thanks, Randy. Good question but yes, I tried that and works like a charm. Was really hoping I could use renderField as that pulls in the Typo settings as well. In most cases I can easily work with just the value and add HTML code to come up with the rendition I'm after but there are a couple cases where I'd rather rely on the Seblod typo (e.g. image lightbox).

Just curious why renderField, which works beautifully in position override won't work in the HTML template (which is Seblod's product)?
147 Posts
MtnPavlas
9 years ago
1
Level 1
Just curious whether it's a bug or "by design" that renderField won't work in the Seblod's HTML template for Intro and Content? Thx, P
9 years ago
0
Level 2
Hi,

It's specific to the seb_html template as it currently only handles '$cck->get' calls.

You can create a request in the tracker if you want the team to add the '$cck->renderField' handling.

Olivier
1283 Posts
Bucklash
8 years ago
0
Level 1

One huge +1

147 Posts
MtnPavlas
8 years ago
0
Level 1

since making my suggestion about renderField above, I've learned a lot about Seblod. By combining any of the existing get functions, one should be able to achieve pretty much anything with the HTML template. You can use

getValue, getTypo, getLink, getHtml (look around the website what each of these do)

The only thing I haven't figured out is how to use PHP directly in the HTML template for conditional styling and other reasons where the Code Pack field won't do (or not easily at least). Position override is the way to go in that case, which is obviously less convenient as the HTML template is right there in the content type screen/UI.

Get a VIP membership