cakephp, giving a cake form custom styling - css

How to I over ride the basic styling for a form in cakePHP? I think the default limits the width of a form to 40% but I need one of my forms to be 100%.
Is something like this the way to go?
<?php echo $this->Form->create('Quote', array('novalidate' => true, 'div' => array('class' => 'div-class'), 'before' => '<div class="quotes-form">', 'after' => '</div>')); ?>

There's any number of ways to do this.
One way would be to do what you're doing. Another would be to not bother with that, and just edit Cake's default css directly, so all forms get styled the way you want.
UPDATE:
You could just do it like this:
<div class="quotes-form">
<?php echo $this->Form->create('Quote', array('novalidate' => true, 'div' => array('class' => 'div-class'))); ?>
<?php // rest of your form elements go here ?>
</div>
Then your css can just be like
.quotes-form form {
background: red;
}

Related

Add anchor tag to wordpress site header customization

I have a Wordpress site that needs some fixes and one of my issues is, that I can't add an anchor tag to the Customize page options list. What I mean is the following:
This is my information module that I can change, but for now it accepts only the <strong> tags along with some others that have been added to the array() that it is using. Here is the code that is working for me now, but as you can see, the anchor has been hardcoded into it:
<div class="text">
<a id="mainPhone" href="tel:02086109182">
<?php echo wp_kses( nl2br( $header_phone ), array( 'br' => array(), 'strong' => array(), 'span' => array() ) ); ?>
</a>
</div>
How can I switch from this to something like this:
<div class="text">
<?php echo wp_kses( nl2br( $header_phone ), array( 'br' => array(), 'strong' => array(), 'a' => array(), 'span' => array() ) ); ?>
</div>
I have added 'a' => array() to it, and as it seems it adds an anchor to the content (it gets underlined and etc.) but It is not clickable (my guess is that the href attribute needs to be added in some way?).
How can I do this? Thanks in advance!

Attach a specific menu to a specific page

In my Wordpress website:
I have two pages, one is in Deutsch and one is in English.
I have two menus, same deal.
I would like to display the english menu when browsing the page in English and display the deutsch menu when browsing the page in Deutsch.
I cannot use any multilingual pluging unfortunately.
Is there any way to achieve this with a basic wordpress installation?
Why can't you use a multi-language plugin?
Assuming you're right about the idea of not being able to use such a plugin, two solutions come to mind:
Use custom fields and conditional logic to display one menu or another
Use page templates to display different menus
You can override the layout of a page by creating a file called page-{slug}.php or page-{id}.php, in which {slug} and {id} should be substituted for the slug or id of the page you wish to make a template for. In this page template you could copy the original layout, but alter the wp_nav_menu command to select a different menu.
There are a few other ways to do it, but those two seem like sensible options to me.
Try this one:
Put this code in header.php while calling navigation menu:
<?php if (is_front_page()) { ?>
<div id='frontPageBanner'>
<?php wp_nav_menu( array( 'container_class' => 'menu-header-1', 'theme_location' => 'primary' ) ); ?>
</div>
<?php } elseif (is_archive()) { ?>
<div id='archiveBanner'>
<?php wp_nav_menu( array( 'container_class' => 'menu-header-2', 'theme_location' => 'primary' ) ); ?>
</div>
<?php } elseif ( is_page($pageID)) { ?>
<div id='pageIdBanner'>
<?php wp_nav_menu( array( 'container_class' => 'menu-header-1', 'theme_location' => 'primary' ) ); ?>
</div>
<?php } ?>
Thanks.

user-menu in secondary-menu: why?

I've created a sub of the zen-theme. And am mighty proud of it, but up in the top right corner (#secondary-menu) the user-menu shows up - perfectly.
I just don't understand how it get's there?
In structure/blocks the user-menu appears in the Disabled section (Region: None)
In fact, there IS no region called "secondary-menu" (id of the element gotten from Firebug)
Isn't that strange?
I can't comment on your specific template files but the standard Zen page.tpl.php file has this in it:
<?php if ($secondary_menu): ?>
<nav id="secondary-menu" role="navigation">
<?php print theme('links__system_secondary_menu', array(
'links' => $secondary_menu,
'attributes' => array(
'class' => array('links', 'inline', 'clearfix'),
),
'heading' => array(
'text' => $secondary_menu_heading,
'level' => 'h2',
'class' => array('element-invisible'),
),
)); ?>
</nav>
<?php endif; ?>
Which should answer how the menu gets printed to the page. If you want to dig one step deeper, the $secondary_menu variable is set up in template_preprocess_page().
As to why it's the user menu...if you go to admin/structure/menu/settings you should see this:
If you change the secondary link source to something else you should see that reflected in your theme too.

wrong wp_nav_menu displayed

my url looks like this:
http://domain.com/?s=searchquery&post_type=qa_faqs
that page lists search results for "searchquery".
i then get the post type with
$post_type = $_GET['post_type'];
it echoes correctly
echo $post_type;
// Provides: qa_faqs
i then do an if/else to display a different menu via wp_nav_menu when $post_type is qa_faqs.
if ( $post_type == 'qa_faqs' ) {
echo 'we got qa_faqs over here';
wp_nav_menu(array('menu' => 'meta_menu', 'items_wrap' => '<dl id="%1$s" class="nice tabs vertical %2$s">%3$s</dl>', 'walker' => new sidenav_walker ));
} else {
echo 'no qa_faqs in da house';
wp_nav_menu(array('menu' => 'service_menu', 'items_wrap' => '<dl id="%1$s" class="nice tabs vertical %2$s">%3$s</dl>', 'walker' => new sidenav_walker ));
}
now to the funny part:
even though the page echoes 'we got qa_faqs over here', it displays the service_menu.
why´s that?
Found it - http://codex.wordpress.org/Navigation_Menus
Same problem was driving me nuts aswell.
Use 'theme_location' instead of 'menu' to point to which menu you want to output.
Try targetting the specific menu with something like:
<?php wp_nav_menu( array('menu' => 'Your Menu Name' )); ?>
I think you dont have any items on the meta_menu. Please create menu under Appearance section and assign it. :)

Yii button with property submit - is not working

Yesterday it was working. After many changes (but not with it template) - it's not.
Yii generates button as usually, but now by clicking it does nothing.
<?= CHtml::button('Sell', array(
'submit' => CController::createUrl('product/selll', array('productID' => $data->id)),
'style' => 'width:80px',
)); ?>
Maybe i have found the problem - it is because jquery.yiiactiveform.js is not loading automaticly. Why it's not loading any more?
I have found solution. The problem is Yii form above, i've comment input text field, than no one Yii::button is working at all.
This is a code of form above:
<?php
$form = $this->beginWidget('CActiveForm', array(
'id' => 'searform',
'enableClientValidation' => true,
'enableAjaxValidation' => true,
'clientOptions' => array(
'validateOnSubmit' => true,
),
'action' => array("user/searchForm"),
));?>
!!!!If i comment this textField - no one CHtml::button dont work.!!!!!
<?php echo $form->textField($search,
'product',array('width'=>'179px','height'=>'17px','value'=>$value,'save'=>$value)); ?>
<? /*
<div id="srcBtnWrap">
<?= CHtml::submitButton('',array('id'=>'srcBtn')); ?>
</div> */ ?>
<? //= CHtml::submitButton('go'); ?>
<?
$this->endWidget();
?>
Is it Yii bug, or i do something wrong?
jquery.yii.js should be loaded. If it is loaded - check JS console for errors.
Check if your action does not use die() or exit()
You have enabled client validation. Please, check errors and give us model fields (rules)
'enableClientValidation' => true,
'enableAjaxValidation' => true,
'clientOptions' => array(
'validateOnSubmit' => true,
),

Resources