Kartik Gridview conflict with my templates menu - yii2

I have a template that i was using for my project.
Look at the picture below:
This is when i am not using the kartikGrid. the dropdown menu running as well as the template want.
look at the image below:
this is when i use kartik, the dropdown menu not running anymore.
can some body tell me why it happen.
The template using different bootsrap version with kartik.
thaks.
Hope some body help me.

Imaginaroom, that did the trick for me thank you.
My top menu wasn't responding (direct link, or drop down menu) after kartik was used. I added an id to my menu widget and it did the trick.
echo Nav::widget([
'id' => 'topMenuID',
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => $menuItems,
]);

Manually assign different ids to all widgets, so there won't be any conflicts.
If you don't assign ids to widgets, yii gives them one automatically, but the problem occures when loading data with ajax or pjax, then Yii cannot know which ids are already used in the page.
Every widget in Yii2 has a property 'id' that you can assign in configuration array when calling a widget.

Add this code in layout or page that has problem:
$this->registerJs( "$(document).ready(function() { $('.dropdown-toggle').dropdown(); });", View::POS_END, 'ecommerceProductJs' );

Related

Yii2 pagination listview PAGE params

is there any way to hide PAGE param in Yii2 pagination listview?
current is domain/(anyattribute)?page=2
output should be domain/(anyattribute)/2
I don't think you can hide it. If you want to hide all of your param attributes then it is possible.
Pjax::begin(['enablePushState' => false]);
//your grid
Pjax::end();
Take a look on https://yii2-cookbook.readthedocs.io/pagination-pretty-urls/
It should solve your problem.

How to render custom menu with childs for nth depth in drupal 7

I found similar answer for my question:
How to print a custom menu in Drupal 7?
but, it is not rendering child with nth depth.
Also, I want to give bootstrap css class to menu item.
Effort
I have created custom menu from
structure > menu
with the name menu-top-course-menu machine name. Now I have this menu rendered in my page template file:
print theme(
'links',
array(
'links' => menu_navigation_links('menu-top-course-menu'),
'attributes' => array(
'class'=> array(
'links',
'menu-top-course-menu'
)
)
)
);
How can I achieve this? Please help me.
Did you try menu block module:
https://www.drupal.org/project/menu_block
https://www.drupal.org/node/1934824
I'm personally using my custom code to generate menu html.
I get menu tree structure with menu_tree_all_data():
$tree = menu_tree_all_data($params['menu']);
https://api.drupal.org/api/drupal/includes!menu.inc/function/menu_tree_all_data/7
Then I'm calling:
menu_tree_add_active_path($tree);
So, it will mark active item well. I think that function is part of that menu block module so you must add dependency for that block to your module.
And then I'm crawling that tree on my own and have full freedom to generate HTML I want.
It's not that easy, but at end I have the code I want, so if everything else fails...

Submit 'links' with CakePHP formHelper

Is it possible to create a submit 'link' with CakePHP 2.4's FormHelper? I'm trying to put some less-used submit buttons from my POST form into a Bootstrap dropdown and am running into trouble since they only seem to be able to create a button, which won't work in a dropdown.
Since this is inside a form already, clearly this isn't what I want a postLink for- but is there any good Cake way around this? postLink just makes a plain link, but it won't play well inside another form.
echo $this->Form->button('Download Excel CSV', array(
'type' => 'submit',
'class' => '',
'formaction' => '/posts/csv',
));
Just use the HtmlHelper's url() method:
<button type="button" formaction="<?php echo $this->Html->url('/posts/csv'); ?>">
Click Here
</button>
(I realize you don't want it in a button element, but - showing the concept).
Side note: you should really be using an array instead of a hard-coded formaction:
$this->Html->url(array('controller'=>'posts', 'action'=>'csv'));

How do I change the HTML that is created with links in Wordpress?

I am trying to create a Wordpress template from static HTML that I made a while back. In the HTML there is a <span> tag within each link in the main navigation menu. It looks like this:
https://www.dropbox.com/s/52zgm8kpj8cfb51/Screenshot%202014-08-25%2018.35.47.png?dl=0
The span accounts for the small tab-like extension to the left of the links. This is to give the page a three-dimensional effect. Unfortunately, when I converted the HTML to a Wordpress theme, I was not able to find how to do this whilst making use of Wordpress' dynamic menu function. This creates the links automatically and generates the HTML. I was wondering if anyone knew a way in which I could edit the generated hyperlinks to include the <span> tag.
Assuming you're using the wp_nav_menu() function to generate the menu links, I believe the code you're looking for is:
<?php
$defaults = array(
'link_before' => '<span>',
'link_after' => '</span>'
);
wp_nav_menu( $defaults );
?>
http://codex.wordpress.org/Function_Reference/wp_nav_menu

How to use only one child theme but have custom text for each site

I am using wordpress multisite for 5 websites. I created a child theme off of the parent so all sites have the same theme, but we have a need for slightly different introduction text at the top of the home pages.
The theme I am using has 3 columns but only has widget-able functionality in column 2 and 3, but the main content area does not have a widget area. Otherwise i would have dropped in a text widget for what i want here.
My question is what is the best way to add this text?
1.) Would I do this in functions.txt? Something like if(site1) echo, elsif(site2) echo, or is there an easier way than this?
2.) Is there a way to do this by editing the theme files and using some short of shortcode? But then where would i define what text to place in there based on the site thats loading?
Please provide a simple example in code if possible. Thanks in advance!
step 1, add to your function.php
<?php
/**
* Register our sidebars and widgetized areas.
*
*/
function arphabet_widgets_init() {
register_sidebar( array(
'name' => 'Column 1',
'id' => 'column_1',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class="rounded">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'arphabet_widgets_init' );
step 2, now you will find the widget area in your dashboard Appearance/Widgets, add your content to it.
step 3 add <?php dynamic_sidebar( 'column_1' ); ?> in your template where you want to have column 1
Beside coding the theme there are also other way maybe easier ...
Use this plugin to create widget zone inside a page:
Widgets on Pages
Versione 0.0.12 | by Todd Halfpenny
Use this plugin so you can display or not the widget deending on what page you are:
Dynamic Widgets
Versione 1.5.6 | by Qurl