Advertisement:

Author Topic: Widgets  (Read 11394 times)

Olfart

  • Newbie
  • *
  • Posts: 35
Re: Widgets
« Reply #15 on: October 17, 2013, 09:57:36 pm »
Thanks so much, I will give this a try, sorry about the delayed reply.

Olfart

  • Newbie
  • *
  • Posts: 35
Re: Widgets
« Reply #16 on: October 17, 2013, 10:19:09 pm »
I do appreciate your help, but it's not working, I inserted the code at the bottom of the page (header.php) and when I do my website goes blank, and in a completely white page. I removed it, the site re-appears.

The code looks fine, but I don't know why the page disappears?

Any suggestions as to why? I have not many any modifications to the original program.

nootkan

  • Sr. Member
  • ****
  • Posts: 259
Re: Widgets
« Reply #17 on: October 17, 2013, 11:43:10 pm »
Post the actual lines of code where you placed the widget code so we can look at it.  Sometimes you have to place in different places within the file to see what works. 

Olfart

  • Newbie
  • *
  • Posts: 35
Re: Widgets
« Reply #18 on: October 21, 2013, 04:20:01 am »
I saw what I did wrong before, I was including all of the code rather than the last portion. I have corrected that but no widget appears on my site, I even added a second one just in case.

Here is the code portion near the top of my header.php

Code: [Select]
<div id="header">
    <div class="wrapper">
        <div id="logo">
            <?php echo logo_header(); ?>
            <span id="description"><?php echo osc_page_description(); ?></span>
        </div>
        <ul class="nav">
            <?php if( osc_is_static_page() || osc_is_contact_page() ){ ?> <?php osc_show_widgets('header') ; ?>
                <li class="search"><a class="ico-search icons" data-bclass-toggle="display-search"></a></li>
                <li class="cat"><a class="ico-menu icons" data-bclass-toggle="display-cat"></a></li>
            <?php ?>

And here is the code near the end of my footer.php

Code: [Select]
        <?php if ( osc_count_web_enabled_locales() > 1) { ?>
            <?php osc_goto_first_locale(); ?>
            <strong><?php _e('Language:''bender'); ?></strong>
            <?php $i 0;  ?>
            <?php while ( osc_has_web_enabled_locales() ) { ?>
            <span><a id="<?php echo osc_locale_code(); ?>" href="<?php echo osc_change_language_url osc_locale_code() ); ?>"><?php echo osc_locale_name(); ?></a></span><?php if( $i == ) { echo " &middot; "; } ?>
                <?php $i++; ?>
            <?php ?>
        <?php ?>
    </div>
</div>
<?php osc_run_hook('footer'); ?>
</body></html>


Thanks again for being kind enough to help here.
« Last Edit: October 21, 2013, 04:22:32 am by Olfart »

nootkan

  • Sr. Member
  • ****
  • Posts: 259
Re: Widgets
« Reply #19 on: October 25, 2013, 04:16:33 am »
Sorry for the delay in responding to your post.  I don't have the same code in my bender theme as you I guess.  Here is the code that I have for you to view.  Just try moving the call around until you get it to work.  I wanted it be above the search and below the logo which is why I placed it where I have it.   As I stated your code may be different so you may have to move the call around  and view it to see if it works.  If it doesn't keep moving and trying different placements. 

Quote
<div id="header">
    <div class="wrapper">
        <div id="logo">
            <?php echo logo_header(); ?>
            <span id="description"><?php echo osc_page_description(); ?></span>
        </div>
        <ul class="nav">
            <?php if( osc_is_static_page() || osc_is_contact_page() ){ ?>
                <li class="search"><a class="ico-search icons" data-bclass-toggle="display-search"></a></li>
                <li class="cat"><a class="ico-menu icons" data-bclass-toggle="display-cat"></a></li>
            <?php } ?>
            <?php if( osc_is_web_user_logged_in() ) { ?>
                <li class="first logged">
                    <span><?php echo sprintf(__('Hi %s', 'bender'), osc_logged_user_name() . '!'); ?>  &middot;</span>
                    <strong><a href="<?php echo osc_user_dashboard_url(); ?>"><?php _e('My account', 'bender'); ?></a></strong> &middot;
                    <a href="<?php echo osc_user_logout_url(); ?>"><?php _e('Logout', 'bender'); ?></a>
                </li>
            <?php } else { ?>
                <li><a id="login_open" href="<?php echo osc_user_login_url(); ?>"><?php _e('Login', 'bender') ; ?></a></li>
                <?php if(osc_user_registration_enabled()) { ?>
                    <li><a href="<?php echo osc_register_account_url() ; ?>"><?php _e('Register for a free account', 'bender'); ?></a></li>
                <?php }; ?>
            <?php } ?>
            <li class="publish"><a href="<?php echo osc_item_post_url_in_category() ; ?>"><?php _e("Publish your ad for free", 'bender');?></a></li>
        </ul>
</div>
<?php if( osc_is_home_page() || osc_is_static_page() || osc_is_contact_page() ) { ?>
    <?php osc_show_widgets('header') ; ?>
    <form action="<?php echo osc_base_url(true); ?>" method="get" class="search nocsrf" <?php /* onsubmit="javascript:return doSearch();"*/ ?>>
        <input type="hidden" name="page" value="search"/>
        <div class="main-search">
            <div class="cell">
                <input type="text" name="sPattern" id="query" class="input-text" value="" placeholder="<?php echo osc_get_preference('keyword_placeholder', 'bender_theme') ; ?>" />
            </div><?php  if ( osc_count_categories() ) { ?>
                <div class="cell selector">
                    <?php osc_categories_select('sCategory', null, __('Select a category', 'bender')) ; ?>
                </div>
                <div class="cell reset-padding">
            <?php  } else { ?>
                <div class="cell">
            <?php  } ?>
                <button class="ui-button ui-button-big js-submit"><?php _e("Search", 'bender');?></button>
            </div>
        </div>
        <div id="message-seach"></div>
    </form>

Olfart

  • Newbie
  • *
  • Posts: 35
Re: Widgets
« Reply #20 on: October 26, 2013, 08:10:43 pm »
Thanks to everyone who tried to help me here. Somehow, be it from plugins or for whatever unknown reason I was not able to get widgets to work, but I did find an alternative solution.

The primary reason I was putting a widget in the first place was to add some important text to above the advertisements. I run a completely free, non profit community service website to help with recycling rather than filling a landfill that is costing us more and more every year. So the text you will see is there accordingly.

What I did was add HTML in the header.php to accomplish the same goal.
Its not a perfect solution due to upgrades in future Bender releases, but it does place the information where I wanted it, I am sure you could do this with images as well as text.



Quote
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="<?php echo str_replace('_', '-', osc_current_user_locale()); ?>">
    <head>
        <?php osc_current_web_theme_path('common/head.php') ; ?>
       <style type="text/css">
      .auto-style1 {
         color: #FFFFFF;
      }
      </style>
    </head>
<body <?php bender_body_class(); ?>>
<div id="header">
    <div class="wrapper">
        <div id="logo">
            <?php echo logo_header(); ?>
            <span id="description"><?php echo osc_page_description(); ?></span>
        </div>
        <ul class="nav">
            <?php if( osc_is_static_page() || osc_is_contact_page() ){ ?>
                <li class="search"><a class="ico-search icons" data-bclass-toggle="display-search"></a></li>
                <li class="cat"><a class="ico-menu icons" data-bclass-toggle="display-cat"></a></li>
            <?php } ?>
            <?php if( osc_users_enabled() ) { ?>
            <?php if( osc_is_web_user_logged_in() ) { ?>
                <li class="first logged">
                    <span><?php echo sprintf(__('Hi %s', 'bender'), osc_logged_user_name() . '!'); ?>  &middot;</span>
                    <strong><a href="<?php echo osc_user_dashboard_url(); ?>"><?php _e('My account', 'bender'); ?></a></strong> &middot;
                    <a href="<?php echo osc_user_logout_url(); ?>"><?php _e('Logout', 'bender'); ?></a>
                </li>
            <?php } else { ?></ul>
            <table style="width: 100%">
            <tr>
               <td style="width: 669px">
               <span class="auto-style1" lang="en-us">Tired of tracking too many Facebook groups? Tired of your ads getting buried in multiple duplicate Facebook buy and sell groups, where no one can find them? We provide you with free advertising space, where you retain your privacy and only respond to serious buyers or sellers. No apps needed here, photos are welcome and really do help sell your items. Simple rules, dedicated to serving local people from Burns Lake to Hazelton. </span></td>
               <td><li><?php fbc_button(); ?>
                <li><a id="login_open" href="<?php echo osc_user_login_url(); ?>"><?php _e('Login', 'bender') ; ?></a></li>
                <?php if(osc_user_registration_enabled()) { ?>
                    <li><a href="<?php echo osc_register_account_url() ; ?>"><?php _e('Register for a free account', 'bender'); ?></a></li>
                <?php }; ?>
            <?php } ?>
            <?php } ?>
</td>
            </tr>
            <li class="publish"><a href="<?php echo osc_item_post_url_in_category() ; ?>"><?php _e("Publish your ad for free", 'bender');?></a></li>
   </table>
        </ul>
    </div>
    <?php if( osc_is_home_page() || osc_is_static_page() || osc_is_contact_page() ) { ?>


nootkan

  • Sr. Member
  • ****
  • Posts: 259
Re: Widgets
« Reply #21 on: October 26, 2013, 08:36:03 pm »
Glad you found a solution.  Not sure why placing that html inside your widget and then calling it from your header.php didn't work for you though.  Good luck with your website and goals.

Emmanuel

  • Hero Member
  • *****
  • Posts: 645
  • .: ♥ Quality Swiss Details ♥ :. .: Swiss Made :.
Re: [NEW] Widgets made easy
« Reply #22 on: March 26, 2014, 01:10:51 am »
Hi all,

Well, Widgets made easy  ;)

https://github.com/osclass/Osclass/pull/1428

Have a great day
Emmanuel