111
Burning
Re: How to customize a form created with XoopsThemeForm class ?
  • 2010/6/14 1:17

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


I had a sudden inspiration (... called Dugris :)))) !

1. add global $xoopsModule; at the start
2. use if ($xoopsModule->dirname() == "oledrion") instead of if ($xoopsModule->name() == "oledrion")

Thanks
Still learning CSS and... english



112
Burning
Re: How to customize a form created with XoopsThemeForm class ?
  • 2010/6/14 0:45

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi' Ghia

Thanks for response :)

I have this error :
Quote:
Undefined variable: xoopsModule dans le fichier /class/xoopsform/themeform.php - ligne 52


Code modified is :
<?php
defined
('XOOPS_ROOT_PATH') or die('Restricted access');

xoops_load('XoopsForm');

class 
XoopsThemeForm extends XoopsForm
{

        function 
insertBreak($extra ''$class '')
        {
        
            if (
$xoopsModule->name() == 'oledrion')
            {
            
                
$class = ($class != '') ? " class='" preg_replace('/[^A-Za-z0-9ss_-]/i'''$class) . "'" '';
                
                if (
$extra) {
                    
$extra '' $class '' $extra '';
                    
$this->addElement($extra);
                } else {
                    
$extra '' $class '';
                    
$this->addElement($extra);
                }
            
            }
            
            else
    
            {
            
                
$class = ($class != '') ? " class='" preg_replace('/[^A-Za-z0-9ss_-]/i'''$class) . "'" '';
                
                if (
$extra) {
                    
$extra '<tr><td colspan="2" ' $class '>' $extra '</td></tr>';
                    
$this->addElement($extra);
                } else {
                    
$extra '<tr><td colspan="2" ' $class '>&nbsp;</td></tr>';
                    
$this->addElement($extra);
                }
            
            }
            
        }


        function 
render()
        {

            if (
$xoopsModule->name() == 'oledrion')
            {
        
                
$ele_name $this->getName();
                
$ret '<form name="' $ele_name '" id="' $ele_name '" action="' $this->getAction() . '" method="' $this->getMethod() . '" onsubmit="return xoopsFormValidate_' $ele_name '();"' $this->getExtra() . '><div class="header-form">' $this->getTitle() . '</div>';  
                
$hidden '';
                
$class '';
                foreach (
$this->getElements() as $ele) {
                    if (!
is_object($ele)) {
                        
$ret .= $ele;
                    } else if (!
$ele->isHidden()) {
                        if (!
$ele->getNocolspan()) {
                            
$ret .= '';
                            if ((
$caption $ele->getCaption()) != '') {
                                
$ret .= '';
                                
$ret .= '' $caption '';
                                
$ret .= '';
                                
$ret .= '';
                            }
                            if ((
$desc $ele->getDescription()) != '') {
                                
$ret .= '' $desc '';
                            }
                            
$ret .= '' $ele->render() . '' NWLINE;
                        } else {
                            
$ret .= '';
                            if ((
$caption $ele->getCaption()) != '') {
                                
$ret .= '';
                                
$ret .= '' $caption '';
                                
$ret .= '';
                                
$ret .= '';
                            }
                            
$ret .= '' $ele->render() . '';
                        }
                    } else {
                        
$hidden .= $ele->render();
                    }
                }
                
$ret .= '' NWLINE ' ' $hidden '</form>' NWLINE;
                
$ret .= $this->renderValidationJS(true);
                return 
$ret;
            }
    
        
            else
    
            {
        
                
$ele_name $this->getName();
                
$ret '<form name="' $ele_name '" id="' $ele_name '" action="' $this->getAction() . '" method="' $this->getMethod() . '" onsubmit="return xoopsFormValidate_' $ele_name '();"' $this->getExtra() . '>
                    <table width="100%" class="outer" cellspacing="1">
                    <tr><th colspan="2">' 
$this->getTitle() . '</th></tr>
                '
;
                
$hidden '';
                
$class 'even';
                foreach (
$this->getElements() as $ele) {
                    if (!
is_object($ele)) {
                        
$ret .= $ele;
                    } else if (!
$ele->isHidden()) {
                        if (!
$ele->getNocolspan()) {
                            
$ret .= '<tr valign="top" align="left"><td class="head">';
                            if ((
$caption $ele->getCaption()) != '') {
                                
$ret .= '<div class="xoops-form-element-caption' . ($ele->isRequired() ? '-required' '') . '">';
                                
$ret .= '<span class="caption-text">' $caption '</span>';
                                
$ret .= '<span class="caption-marker">*</span>';
                                
$ret .= '</div>';
                            }
                            if ((
$desc $ele->getDescription()) != '') {
                                
$ret .= '<div class="xoops-form-element-help">' $desc '</div>';
                            }
                            
$ret .= '</td><td class="' $class '">' $ele->render() . '</td></tr>' NWLINE;
                        } else {
                            
$ret .= '<tr valign="top" align="left"><td class="head" colspan="2">';
                            if ((
$caption $ele->getCaption()) != '') {
                                
$ret .= '<div class="xoops-form-element-caption' . ($ele->isRequired() ? '-required' '') . '">';
                                
$ret .= '<span class="caption-text">' $caption '</span>';
                                
$ret .= '<span class="caption-marker">*</span>';
                                
$ret .= '</div>';
                            }
                            
$ret .= '</td></tr><tr valign="top" align="left"><td class="' $class '" colspan="2">' $ele->render() . '</td></tr>';
                        }
                    } else {
                        
$hidden .= $ele->render();
                    }
                }
                
$ret .= '</table>' NWLINE ' ' $hidden '</form>' NWLINE;        
                
$ret .= $this->renderValidationJS(true);
                return 
$ret;    
        
            }
    
        }
        
}
?>


Is there something else to do, or error(s) ?
Still learning CSS and... english



113
Burning
How to customize a form created with XoopsThemeForm class ?
  • 2010/6/13 20:27

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi'

I have some difficulties (that's an euphemism) with Oledrion search form. I would like to customize it, and actually it works fine :

Resized Image



However to obtain this result I have to modify a Xoops class (I think it is the right word), into : www/class/xoopsform/themeform.php.

Why ? Because my original form is made with this 'class'. Here it is the only information that I have in module template about this form (oledrion_search.html) :
<!-- Created by Instant Zero (http://www.instant-zero.com) -->
<{$breadcrumb}>
<
br />
<{if 
$global_advert != ''}>
    <
div align='center'><{$global_advert}></div>
    <
br />
<{/if}>
<{if 
$search_results}>
    <
h2><{$smarty.const._OLEDRION_SEARCHRESULTS}></h2>
    <
br />
    <{foreach 
item=product from=$products}>
        <
img src='<{$smarty.const.OLEDRION_IMAGES_URL}>product.png' alt='' border='0' />&nbsp;<b><a href="<{$product.link}>" title="<{$product.href_title}>"><{$product.title}></a></b><br />
    <{/foreach}>
    <{if 
$pagenav !=''}><div style="text-align: right; margin: 10px;"><{$pagenav}></div><{/if}>
    <
br />
<{/if}>
<{
$search_form}>


To recap : to modify <{$search_form}> I have to modify themeform.php file.




But if I do that, ALL my forms in Xoops administration are destroyed. This is a screenshot of System preferences :

Resized Image




I don't know how to create a specific template for Oledrion search engine, I mean how to customize <{$search_form}> without destroy all xoops forms


Some help / advice would be very welcome :) !
Still learning CSS and... english



114
Burning
Re: Show table cell borders
  • 2010/6/13 16:53

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


It is as you want, not important ;)
Still learning CSS and... english



115
Burning
Re: Show table cell borders
  • 2010/6/13 15:27

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


Ok... I don't know why it does not work.

Just replace last lines in style.css by :
Quote:

/* smartsection tables */
div.itemText table tr td {
border: 1px solid #888 !important;
padding: 10px;
}
Still learning CSS and... english



116
Burning
Re: Show table cell borders
  • 2010/6/13 12:29

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


You have another solution, but borders will be displayed for all tables used by smartsection module (it means you will have to correct some templates).


1. Modify theme.html

Replace :
Quote:

<div id="xo-content">
<{$xoops_contents}>
</div>


... by :
Quote:

<div id="xo-content" class="<{$xoops_dirname}>">
<{$xoops_contents}>
</div>



2. Modify style.css

Replace :
Quote:
/* smartsection tables */
table.i-want-a-black-border tr td {
border: 1px solid #888 !important;
padding: 10px;
}


... by :
Quote:

#xo-content .smartsection table tr td {
border: 1px solid #888 !important;
padding: 10px;
}



3. Modify your input

Delete class="i-want-a-black-border", not used anymore.



... tell me if it works and if you have trouble with templates


Edit : smartsection template (smartsection_item.html) encapsulates articles content in a div

Quote:

<div class="itemText">
<{$item.maintext}>
</div>


Try to replace by :
Quote:

<div class="itemText plus-border-for-my-tables">
<{$item.maintext}>
</div>


And in style.css replace :
Quote:

#xo-content .smartsection table tr td {
border: 1px solid #888 !important;
padding: 10px;
}


... by :
Quote:

#xo-content .smartsection .plus-border-for-my-tables table tr td {
border: 1px solid #888 !important;
padding: 10px;
}


If it works, it should not impact other smartsections tables...



Edit bis : write table and not .table as I wrote before. Code corrected.
Still learning CSS and... english



117
Burning
Re: Show table cell borders
  • 2010/6/13 12:28

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


oups ! dbl post :(
Still learning CSS and... english



118
Burning
Re: Show table cell borders
  • 2010/6/13 12:06

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi'

... my apologizes, #module-folder-name selection does not work with this theme

You should try :
/* smartsection tables */
table.i-want-a-black-border tr td {
border1px solid #888 !important;
padding10px;
}


... I believe you can easily obtain something nicer, but it should work.
Still learning CSS and... english



119
Burning
Re: xNews 1.68 RC1 - Bug report
  • 2010/6/13 11:17

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi'

French translation available for xNews 1.68 (UTF8 without BOM) :
download link
Still learning CSS and... english



120
Burning
Re: Show table cell borders
  • 2010/6/13 10:28

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi' Chefry,

Quote:
I can get the data to appear properly, but some of my tables are very big and they REALLY need the borders around the cells.

Could you provide a link for a page wich displays such table ?

Here I see a table (with light borders)... it is about these tables ?
Still learning CSS and... english




TopTop
« 1 ... 9 10 11 (12) 13 14 15 ... 74 »



Login

Who's Online

249 user(s) are online (150 user(s) are browsing Support Forums)


Members: 1


Guests: 248


AventurineLe,

more...

Donat-O-Meter

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

Latest GitHub Commits