21
bumciach
Re: Issue with icon used in browser
  • 2012/2/29 11:25

  • bumciach

  • Not too shy to talk

  • Posts: 153

  • Since: 2007/6/25


What Theme do you use?
Browse /themes/yourthemename/ looking for icons



22
bumciach
Tilt 3D - firefox plugin
  • 2012/2/21 13:03

  • bumciach

  • Not too shy to talk

  • Posts: 153

  • Since: 2007/6/25


Tilt is a Firefox addon that lets you visualize any web page in 3D.
More info and videos
I instaled it today. It seems to be very helpful to understand webpage structure in addition to Firebug.



23
bumciach
XoopsFormSelect with styled and disabled options
  • 2012/2/20 13:25

  • bumciach

  • Not too shy to talk

  • Posts: 153

  • Since: 2007/6/25


I expanded the class XoopsFormSelect for my needs, but may also be useful to someone.
I needed to color a few items in the select list. Of course you can use javascript. In this case it was convenient for me to modify the methods of the class (only addOption, addOptionArray not). In Xoops 2.2.x was also able to option disabled, so I added it too.

class pfXoopsFormSelect extends XoopsFormSelect
{
    
/**
     * Options
     *
     * @var array
     * @access private
     */
    
var $_options = array();


    
/**
     * Constructor
     *
     * @param string $caption Caption
     * @param string $name "name" attribute
     * @param mixed $value Pre-selected value (or array of them).
     * @param int $size Number or rows. "1" makes a drop-down-list
     * @param bool $multiple Allow multiple selections?
     */
    
function pfXoopsFormSelect($caption$name$value null$size 1$multiple false)
    {
        
$this->setCaption($caption);
        
$this->setName($name);
        
$this->_multiple $multiple;
        
$this->_size intval($size);
        if (isset(
$value)) {
            
$this->setValue($value);
        }
    }

    
/**
     * Add an option
     *
     * @param string $value "value" attribute
     * @param string $name "name" attribute
     * @param array,string $styles style definitions or class name (CSS)
     * @param bool $disabled set option as disabled if true            
     */
    
function addOption($value$name ''$styles null$disabled false)
    {
        if (
$name != '') {
            
$this->_options[$value]['name'] = $name;
        } else {
            
$this->_options[$value]['name'] = $value;
        }
        if (
is_array($styles)) {
            
$this->_options[$value]['style'] = $styles['style'];
            
$this->_options[$value]['class'] = $styles['class'];
        }
        else if (!empty(
$styles)) {
            
$this->_options[$value]['class'] = $styles;
        }
        if (
$disabled === true) {
            
$this->_options[$value]['disabled'] = true;
        }
    }

    
/**
     * Prepare HTML for output
     *
     * @return string HTML
     */
    
function render()
    {
        
$ele_name $this->getName();
        
$ele_title $this->getTitle();
        
$ele_value $this->getValue();
        
$ele_options $this->getOptions();
        
$ret '<select size="' $this->getSize() . '"' $this->getExtra();
        if (
$this->isMultiple() != false) {
            
$ret .= ' name="' $ele_name '[]" id="' $ele_name '" title="'$ele_title'" multiple="multiple">' ;
        } else {
            
$ret .= ' name="' $ele_name '" id="' $ele_name '" title="'$ele_title'">' ;
        }
        foreach(
$ele_options as $value => $name) {
            
$ret .= '<option value="' htmlspecialchars($valueENT_QUOTES) . '"';
            if ( !empty(
$name['class']) ) {
                
$ret .= ' class="' htmlspecialchars($name['class'], ENT_QUOTES) . '"';
            } 
            if ( !empty(
$name['style']) ) {
                
$ret .= ' style="' htmlspecialchars($name['style'], ENT_QUOTES) . '"';
            }
            if ( !empty(
$name['disabled']) ) {
                
$ret .= ' disabled="disabled"';
            } 
            if (
count($ele_value) > && in_array($value$ele_value)) {
                
$ret .= ' selected="selected"';
            }
            
$ret .= '>' $name['name'] . '</option>' ;
        }
        
$ret .= '</select>';
        return 
$ret;
    }

}

use
For example in. css
.greens {colorgreenborder1px solidfont-size1.8em;}

php
include_once("pfformselect.php");
$testsel = new pfXoopsFormSelect'Caption''test_select'$value );
              
$testsel->addOption'''' );
              
$testsel->addOption'1''no css' );
              
$testsel->addOption'2''style', array('style'=>'color:red;') );
              
$testsel->addOption'3''class', array('class'=>'greens') ); //or: $testsel->addOption( '3', 'class', 'greens' );
              
$testsel->addOption'4''disabled'''true );
              
$testsel->addOption'5''style and class', array('style'=>'font-weight:bold;''class'=>'greens') );
            
$this->addElement($testselfalse);


result:
Resized Image

Resized Image
NOTICE: This is just an example of Firefox. Different browsers interpret style for <option> in different ways. IE displays only the text colors.

By the way. Why in the method getOption() is sanitized when render() forced to htmlspecialchars.



24
bumciach
Re: XoopsFormDateTime empty field?
  • 2012/1/19 12:11

  • bumciach

  • Not too shy to talk

  • Posts: 153

  • Since: 2007/6/25


Better solution - use OOP: extend original class XoopsFormTextDateSelect and add parameter $autofill

class pfFormTextDateSelect extends XoopsFormTextDateSelect
{

    
/**
     * Constructor
     *
     * @param string      $caption Caption
     * @param string      $name "name" attribute
     * @param int         $size Size
     * @param int,string  $value Initial date (timestamp format) or English textual datetime description which can be converted to timestamp (see: strtotime PHP function)
     * @param bool         $autofill If $value is empty or not recognized textual datetime the form field filled current date ($autofill = true) or leave empty    
     */
    
function pfFormTextDateSelect($caption$name$size 15$value 0$autofill true)
    {
        
// previous to PHP 5.1.0 you would compare with -1, instead of false
        
if ( strtotime($value) !== false OR strtotime($value) != -) {
            
$value strtotime($value);
        }        
        if ( 
$autofill === true ) {
          
$value = !is_numeric($value) ? time() : intval($value);
          
$value = ($value == 0) ? time() : $value;
        }
        else {
          
$value = !is_numeric($value) ? '' intval($value);
          
$value = ($value == 0) ? '' $value;
        }
        
$this->XoopsFormText($caption$name$size25$value);
    }

}


Moreover this class accepts English textual datetime description and convert it into a timestamp (seehttp://php.net/manual/en/function.strtotime.php).
Example, this displays a later date by one day:
new pfFormTextDateSelect('''test'10'+1 day'false);

Empty field:
new pfFormTextDateSelect('''test'10''false);





25
bumciach
Re: XoopsFormDateTime empty field?
  • 2012/1/18 10:59

  • bumciach

  • Not too shy to talk

  • Posts: 153

  • Since: 2007/6/25


NOTICE: This my function from above doesn't work since Xoops 2.5.4. There were changes in xoops calendar and the file: /include/calendarjs.php even not exist in the latest Xoops.



26
bumciach
Re: XoopsObject & XoopsObjectHandler some guidelines?
  • 2011/2/1 12:06

  • bumciach

  • Not too shy to talk

  • Posts: 153

  • Since: 2007/6/25


Quote:

I have an other dummy question what is the diffrence between XoopsObjectHandler and XoopsPresistentObjectHandler?


Look into /kernel/object.php
XoopsPresistentObjectHandler has the same methods (and many more) like XoopsObjectHandler. But "fill" them with code.
I'm using only XoopsPresistentObjectHandler, so I do not know if XoopsObjectHandler is useful to something.



27
bumciach
Re: setDescription
  • 2011/1/5 10:53

  • bumciach

  • Not too shy to talk

  • Posts: 153

  • Since: 2007/6/25


setDescription method works only for individual form elements
Example for text type input:
$page_banner = new XoopsFormText_AM_SYSTEM_BANNERS_CONTNAMET'banners'55$this->getVar'banners''e' ) );
$page_banner->setDescription_AM_SYSTEM_BANNERS_CONTNAMET_DESC );
$form->addElement$page_banner );



28
bumciach
How to use PNG format
  • 2010/12/29 11:26

  • bumciach

  • Not too shy to talk

  • Posts: 153

  • Since: 2007/6/25


Great (but simple) article about PNG format.
PNG supports various combinations of color depth, transparency and color correction. Some combinations work perfectly with every piece of software, and some are practically useless.

PNG that works



29
bumciach
Re: Oledrion and CKEditor : how to compress html ?
  • 2010/12/20 14:36

  • bumciach

  • Not too shy to talk

  • Posts: 153

  • Since: 2007/6/25


Quote:

novlang1984 wrote:
Just add this to ckeditor/config.js

You can also add this to file ckeditor/module/config.oledrion.js (it's placeholder for module specific configurations in CKEditor). In case when updating CKEditor file ckeditor/config.js will be replaced by the original one.



30
bumciach
Re: Smarty 3
  • 2010/11/22 12:29

  • bumciach

  • Not too shy to talk

  • Posts: 153

  • Since: 2007/6/25


The biggest difference between smarty 2 and 3 is that the S3 has been completely rewritten in PHP5. S3 placed great emphasis on backwards compatibility, so apart from the fact that it will not work on php4 there should be no other problems. But therefore not expect great changes in speed. Smarty 3 is not a revolution.

PS. Looking for information on Smarty landed onhttp://dwoo.org/ project. It seems that it is compatible with smarty but is more advanced. Not tested, showing only as a curiosity ;)




TopTop
« 1 2 (3) 4 5 6 ... 14 »



Login

Who's Online

199 user(s) are online (130 user(s) are browsing Support Forums)


Members: 0


Guests: 199


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits