Recent Topics

1 Aug 26, 2009 22:40    

My b2evolution Version: 3.31

Hi, I added two custom fields in the blog settings, but I'm having a hard time calling them up in a skin.

I tried:
if( !empty( $Item->Custom_Name ) )

or the actual field name:

if( !empty( $Item->post_varchar1 ) )

but neither seemed to work. Does anyone else have this working?

Thanks so much!

2 Aug 27, 2009 02:26

Try this
$Item->varchar1
$Item->double3

3 Aug 28, 2009 06:21

great! That did the trick. Thanks!

4 Aug 28, 2009 11:13

I don´t know what to think about.
I´ve been for a month trying to to show in my articles some fields (including the new ones... varchar and double) and, some of them work and others no.
For instance, excerpt, priority and, of course, title, author....
But I tried with these brand new fields and don´t work in my skins.

Could you show me, please, the part of the code where you put the fields and work?

5 Aug 28, 2009 17:52

I used it in the skin's item_content_inc.php file, like so:

<?php if( !empty( $Item->varchar1 ) ) { ?>
<a href="<?php echo $Item->varchar1;?>">

6 Aug 28, 2009 18:18

Thanks! I´ll try it. Just in case! In which skin?

7 Aug 29, 2009 01:55

A custom one I developed for a site, but it should work in any skin.

8 Aug 29, 2009 14:38

At last, I find out the way: I used to add the field in this way

$Item->varchar1

, as I added others ones.
But, I tried coding in a "new" way::oops: :oops: :oops:

echo $Item->varchar1

It works.....

Uf!!! Thank you!!!!!!!!!!!!!!!!!1

9 Mar 01, 2010 17:01

This is the best i could've come up with..pretty satisfactory, except the fact that i couldnt somehow use an autoincrement but wrote the numbers manually so the code grows a little long:

<?php //make sure the field is not empyy
if( !empty( $Item->double1 ) )
 { 
$field_name = $Blog->get_setting('custom_double'.'1');
//display custom field name
			echo ''.$field_name.':';
//display custom field value
echo $Item->double1;
} ?>

<?php 
if( !empty( $Item->double2 ) )
 { 
$field_name = $Blog->get_setting('custom_double'.'2');
//display custom field name
			echo ''.$field_name.':';
//display custom field value
echo $Item->double2;
} ?>

<?php 
if( !empty( $Item->double3 ) )
 { 
$field_name = $Blog->get_setting('custom_double'.'3');
//display custom field name
			echo ''.$field_name.':';
//display custom field value
echo $Item->double3;
} ?>

<?php 
if( !empty( $Item->double4 ) )
 { 
$field_name = $Blog->get_setting('custom_double'.'4');
//display custom field name
			echo ''.$field_name.':';
//display custom field value
echo $Item->double4;
} ?>

<?php 
if( !empty( $Item->double5 ) )
 { 
$field_name = $Blog->get_setting('custom_double'.'5');
//display custom field name
			echo ''.$field_name.':';
//display custom field value
echo $Item->double5;
} ?>

10 Mar 01, 2010 17:23

<?php
for( $i = 1; $i < 5; $i++ )
{
  $var = 'double'.$i;
  if( !empty( $Item->$var ) )
  {
    $field_name = $Blog->get_setting('custom_double'.$i);
    //display custom field name
    echo ''.$field_name.':';
    //display custom field value
    echo $Item->$var;
  } 
}
?>

;)

¥

11 Mar 01, 2010 19:07

yeah that is genius, i am just learning, so thanks for the tip but keep your effort belittling winks to yerself P:

13 Mar 01, 2010 19:22

-_-

why arent you on irc anyway |-|

edit: even this: 88| has its own smiley but this: -_- does not ? i mean come on wtf is this : 88|

14 Mar 01, 2010 19:23

Cos I forgot to start it :p

¥


Form is loading...