Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 10-06-2013, 02:14 PM
fariborz khan's Avatar
fariborz khan fariborz khan is offline
 
Join Date: Jul 2007
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How push css of template to that use by widget?

i want create a widget and put a picture in it
i read forum an i see that i must create a template like this :
PHP Code:
<div class="block">
<
div class="cms_widget_header"> </div>
<
div class="cms_widget_content widget_content">
<
div style="text-align:center">
<
a href="http://www.vbhispano.com/foros/sendmessage.php?subject=0" rel="nofollow">
<
img alt="Publicidad Disponible" src="http://imagenes.chevereto.net/images/qnZaF.png" title="Publicidad Disponible">
</
a>
</
div>
</
div
and create a widget and put created template name to load that template for me
but i see that template use default vbulletin css.
Now:
i want push css of template to this widget that i can customize only this widget
in other hand i want push below item to my created template(i think i must use complete html code but i don't know what i must write it that contain style variable on it)
PHP Code:
.widget_content {
    
backgroundnone repeat-x scroll 0 0 #FFFFFF;
    
border1px solid #DADADA;
    
border-radius0 0 0 0;
    
color#424242;
    
padding10px 6px;

that when i change this item change apply only to this widget.

what is the best way that i can do it easily i must say that i see blow links but i want easy way that i can do this.

[HOW TO - vB4] Rendering templates and registering variables - a short guide



[HOW-TO vB4] Create a Widget using Plugins and Templates

and see this beautiful guide from kh99
Quote:
Originally Posted by kh99 View Post
If you go to vbulletin CMS -> Widgets and click on "configure" next to your widget, at the bottom there's a Template Name field that probably says 'vbcms_widget_static_page'. You could copy the vbcms_widget_static_page template code to a new template, enter that new template name on the widget config page, then edit that template to look the way you want.
Reply With Quote
  #2  
Old 10-07-2013, 10:14 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you asking how to create CSS so that it will only apply to that specific widget?
Reply With Quote
  #3  
Old 10-07-2013, 05:07 PM
fariborz khan's Avatar
fariborz khan fariborz khan is offline
 
Join Date: Jul 2007
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
Are you asking how to create CSS so that it will only apply to that specific widget?
yes i want posh css criteria to my template
for example i want when create template i use

PHP Code:
    background-color#F1F1F1;
    
border1px solid #C1C1C1;
    
border-radius5px 5px 5px 5px;
    
box-shadow: -2px 2px 2px #C8C8C8;
    
clearboth;
    
displayblock;
    
overflowhidden;
    
width100%; 
code in it
Reply With Quote
  #4  
Old 10-07-2013, 05:12 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Then you will either need to style your template inline, ie:

<div style="background: red;">...

Or you will need to give the template divs their own class and then write css for it, ie:

<div class="myown1">

then in additional.css:
div.myown1 {background: red;}
Reply With Quote
2 благодарности(ей) от:
fariborz khan, tbworld
  #5  
Old 10-07-2013, 05:46 PM
fariborz khan's Avatar
fariborz khan fariborz khan is offline
 
Join Date: Jul 2007
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks Lynne
i use your second advise and it work perfectly and i create this

now how put another to white area
so in one column of grid i can use 2 widget in one row
Attached Images
File Type: png 21.png (45.4 KB, 0 views)
Reply With Quote
  #6  
Old 10-07-2013, 06:35 PM
fariborz khan's Avatar
fariborz khan fariborz khan is offline
 
Join Date: Jul 2007
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks lynne i do this
Attached Images
File Type: png 23.png (44.5 KB, 0 views)
Reply With Quote
  #7  
Old 10-07-2013, 10:35 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have been working on extending the "widget_id" to the CMS widget, preview, article templates. This would allow us to target an individual view or widget template, without having to modify the actual template. You could then change the "relative" look via CSS on an individual basis -- obviously it doesn't change the html. It would be possible, now that we have a "widget_id" to change the HTML via JavaScript dynamically.

For example in CMS templates:
Code:
<div id="cms_wrapper_{vb:var widget_id}">

     normal widget code here...

</div>
I have this working, but I am trying to figure out how to package it. Very few hooks in the CMS code.

Then in your additional CSS, taken from @Lynne's post, in your CSS:

Code:
   div.cms_wrapper_12 {background: red;}
This would target widget 12. One problem is that the widget id's are not displayed in the admincp like the forum id's so a patch has to be installed in there as well -- so the widget id's can be easily discovered.
Reply With Quote
  #8  
Old 10-08-2013, 02:53 AM
fariborz khan's Avatar
fariborz khan fariborz khan is offline
 
Join Date: Jul 2007
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks for your attention
I omitted h3 code in this widget because I like use it as link to advertisement or where I want like Home,Forum, or another and create a metro like template.
thanks again
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:40 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05356 seconds
  • Memory Usage 2,266KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (3)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (2)post_thanks_box_bit
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (2)postbit_attachment
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete