Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Mar 2009
    Posts
    175
    Thanks
    3
    Thanked 1 Time in 1 Post

    Just want to add a space at the beginning of return

    The below code returns a radio list after an input box in a profile edit section.
    All I want to do is add a space at the beginning of the radio list so to separate the input box and the radio list.
    Where the magic happens here is on this line:
    PHP Code:
    return $selhtml ' ' getFieldIcons$_CB_framework->getUi(), $requirednull$fieldHandler->getFieldDescription$field$user$output$reason ), $fieldHandler->getFieldTitle$field$user$output$reason ) ); 
    I've tried several variations of trying to use &nspb; both in the return string directly as well as creating a var for it. I've tried various ways of wrapping it in a div to simply add a margin, I've tried kicking my dog, I've tried banging my head against the wall, nothing seems to work. I either get a t var error, an unexpected something or other like . or & error depending on what I'm doing, or it tries to divide by zero using /'s.

    Here's a larger view of the code:
    PHP Code:
        function onFieldIcons( &$fieldHandler, &$field, &$user$output$reason$tag$type$value$additional$allValues$displayFieldIcons$required ) {
            global 
    $_CB_framework$ueConfig$_CB_fieldIconDisplayed;

            if ( 
    is_object$field->params ) ) {
                
    $privacyLevel                    =    $field->params->get'plug_cbprivacy_level' );
            } else {
                
    $privacyLevel                    =    0;
            }

            if ( 
    $displayFieldIcons && ( $reason != 'search' ) ) {
                if ( ( 
    $privacyLevel == ) && ( $field->profile != ) ) {

                    
    $privacy                    =&    moscomprofilerPrivacy::getInstance$user'field'$field->fieldid );
                    
    $selected                    =    ( $privacy $privacy->rule '' );

                    
    $selectorName                =    $field->name '___cbprivacy';

                    
    $connTypes                    =    array();
                    if ( 
    $this->params->get'conns_by_type') ) {
                        if ( 
    $ueConfig['connection_categories'] ) {
                            
    $connTypes            =    explode"\n"$ueConfig['connection_categories'] );
                            foreach ( 
    array_keys$connTypes ) as $k) {
                                
    $connTypes[$k]    =    trim$connTypes[$k] );
                            }
                        }
                        if ( 
    $selected == ) {
                            
    $type                =    $privacy->getParam'conn_cat' );
                            if ( 
    $type ) {
                                
    $selected        =    $selected '|*|' $type;
                            }
                        }
                    }
                    
    $options                    =    array();
                    
    $options[]                    =    moscomprofilerHTML::makeOption'''' CBTxt::T('     ') );
                    if ( ( 
    $ueConfig['allow_profileviewbyGID'] == -) && $this->params->get'prop_registered') ) {
                        
    $options[]                =    moscomprofilerHTML::makeOption'1''' CBTxt::T('     ' ) );
                    }
                    if ( 
    $ueConfig['allowConnections'] ) {
                        
    $prop_connections        =    $this->params->get'prop_connections');
                        if ( 
    $prop_connections ) {
                            
    $options[]            =    moscomprofilerHTML::makeOption'2''' CBTxt::T'     ' ) );
                        }
                        if ( 
    count$connTypes ) > ) {
                            foreach (
    $connTypes as $type ) {
                                
    $options[]        =    moscomprofilerHTML::makeOption'2|*|' htmlspecialchars$type ), ( $prop_connections '  ⌊ ' '' ) . '' sprintfCBTxt::T'Only for %s' ), $type ) );
                            }
                        }
                        if ( 
    $this->params->get'prop_fofs') ) {
                            
    $options[]            =    moscomprofilerHTML::makeOption'3''' CBTxt::T'Also for friends of friends' ) );
                        }
                    }
                    if ( 
    $this->params->get'prop_invisible') ) {
                        
    $options[]                =    moscomprofilerHTML::makeOption'99''' CBTxt::T' ' ) );
                    }
                    
    $selHtml                    =    moscomprofilerHTML::radioList$options$selectorName'''value''text'$selected2false );
                    if ( isset( 
    $_CB_fieldIconDisplayed[$field->fieldid] ) ) {
                        return 
    $selHtml;
                    } else {
                        
    $_CB_fieldIconDisplayed[$field->fieldid]    =    true;
                        return 
    $selHtml ' ' getFieldIcons$_CB_framework->getUi(), $requirednull$fieldHandler->getFieldDescription$field$user$output$reason ), $fieldHandler->getFieldTitle$field$user$output$reason ) );
                    }
                } else {
                    if ( isset( 
    $_CB_fieldIconDisplayed[$field->fieldid] ) ) {
                        return 
    null;
                    } else {
                        
    $_CB_fieldIconDisplayed[$field->fieldid]    =    true;
                        return 
    getFieldIcons$_CB_framework->getUi(), $required$field->profile$fieldHandler->getFieldDescription$field$user$output$reason ), $fieldHandler->getFieldTitle$field$user$output$reason ) );
                    }
                    
                }
                
            } else {
                return 
    null;
            } 
        } 
    The basic layout here is this:
    |inputbox||radio list|
    But I want:
    |inputbox| |radio list|
    Last edited by sfraise; 11-03-2010 at 09:50 PM.

  • #2
    Regular Coder
    Join Date
    Mar 2009
    Posts
    175
    Thanks
    3
    Thanked 1 Time in 1 Post
    SOLVED

    I created a var for it
    $nbsp = " ";

    Then added the var to the beginning of the string with a . at the end
    return $nbsp. $selHtml blablabla

    I new if I just kept kicking the dog it would come to me.

  • #3
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    No need to create a var. Just add it straight:

    Code:
    return ' '.$selhtml.' '

  • #4
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,998
    Thanks
    15
    Thanked 234 Times in 234 Posts
    And PHP takes text formatting literally so if you use an actual space and not & nbsp ; it may work just as well.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •