php - Editing the elements produced in a foreach loop -
i'm using plugin website built on php based cms uses kohana.
the plugin generates new drop down menu. believe actual menu generated script "sharing_bar.php. script below. believe foreach function @ bottom need edit.
i'd 2 things:
hide first line item of menu
change text in second item of menu. text generated dynamic via function.
the website in question here: http://tinyurl.com/c8djrvr box i'd change right , called "site filter" 3 items:
- all
- crowdsourced architectural salvage
- archives
i'd change display 2 items:
- all sites: hidden
- crowdsourced architectural salvage > "current"
- archives > no change
at end of foreach function div "site_name". existing list above site names (crowdsourced architectural salvage & archives). function pulling in names dynamically. need "hard edit" names here , don't know how to.
<div class="cat-filters clearingfix" style="margin-top:20px;"> <strong><?php echo kohana::lang('sharing_two.site_filter');?> <span>[<a href="javascript:togglelayer('sharing_switch_link','sharing_switch')" id="sharing_switch_link"> <?php echo kohana::lang('ui_main.hide'); ?></a>] </span> </strong> </div> <ul id="sharing_switch" class="category-filters"> <li><a href="#" id="share_all" <?php if (kohana::config('sharing_two.default_sharing_filter') == 'all') echo' class="active"'; ?>> <div class="swatch" style="background-color:#<?php echo kohana::config('settings.default_map_all'); ?>"></div> <div><?php echo kohana::lang('sharing_two.all_sites') ?></div> </a></li> <li><a href="#" id="share_main"<?php if (kohana::config('sharing_two.default_sharing_filter') == 'main') echo' class="active"'; ?>> <div class="swatch" style="background-color:#<?php echo kohana::config('settings.default_map_all'); ?>"></div> <div><?php echo kohana::config('settings.site_name') ?></div> </a></li> <?php foreach ($sites $site) { $class = (kohana::config('sharing_two.default_sharing_filter') == $site->id) ? "active" : ''; echo '<li><a href="#" id="share_'. $site->id .'" class="'.$class.'"><div class="swatch" style="background-color:#'.$site->site_color.'"></div><div>'.$site->site_name.'</div></a></li>'; } ?> </ul>
remove first <li> remove 'all'. second <li> have add item current settings , use that. check http://docs.kohanaphp.com/core/kohana#methods_config more details on config.
<ul id="sharing_switch" class="category-filters"> <li><a href="#" id="share_main"<?php if (kohana::config('sharing_two.default_sharing_filter') == 'main') echo' class="active"'; ?>> <div class="swatch" style="background-color:#<?php echo kohana::config('settings.default_map_all'); ?>"></div> <div><?php echo kohana::config('settings.current') ?></div> </a></li> <?php foreach ($sites $site) { $class = (kohana::config('sharing_two.default_sharing_filter') == $site->id) ? "active" : ''; echo '<li><a href="#" id="share_'. $site->id .'" class="'.$class.'"><div class="swatch" style="background-color:#'.$site->site_color.'"></div><div>'.$site->site_name.'</div></a></li>'; } ?> </ul> alternatively can replace <?php echo kohana::config('settings.site_name') ?> current . not practice.
Comments
Post a Comment