I'm trying to find out how to display pagination buttons withou displaying numbers over the buttons. In documentation there is no word about this, but i assume that it's possible to manage this thing.
You can do this with Javascript or simply CSS by hide the text content.
For example if you paginated your results in like this means
<div id="paginator">
<?php echo $this->Paginator->prev('Previous'); ?>
<?php echo $this->Paginator->first('First'); ?>
<?php echo $this->Paginator->numbers(array('class' => 'number', 'first' => false, 'last' => false, 'separator' => '-')); ?>
<?php echo $this->Paginator->last('Last'); ?>
<?php echo $this->Paginator->next('Next'); ?>
</div>
Using CSS you can hide as follow
<style>
#paginator span
{
border:1px saddlebrown solid;
padding:3px;
margin: 2px;
background: #1e7ec8;
color: brown;
}
#paginator span a
{
text-decoration: none;
color: white;
}
#paginator .number a
{
color:transparent;
}
</style>
Also using Javascript or Jquery you can set text of numbers class empty by following
$(document).ready(function() {
$('.number').text('');
});
Related
$this->Form->checkbox('username', array('value' => 'basssr', 'style' => 'float: left; display: inline'));
this code only show check box not values
Try this:
<div style="float:left;">
<?php
echo $this->Form->input('username', array('type' => 'checkbox','value' => 'basssr', 'style' => 'float: left; display: inline'));
?>
</div>
this code put it 2 times This will shows checkboxes in horizontal.
Is is possible to program my site in such a way that these two columns of posts on the homepage will also display as two columns on a smart phone? I'm using a twenty twelve child theme, which is a responsive theme, but the code I used to create the two columns of posts is pretty elementary, so it's just combining into one column on a smart phone.
below is an excerpt of code from my index.php that shows the way i'm creating the two columns. these divs also correspond with simple CSS in my style.css file
i'd gladly take a different approach to creating the columns if it allows them to show as two independent columns on a smart phone as well.
the site is at: internalcompass.us/castle if you want to look at the page
thanks
</div>
<div id="right-column">
<?php $my_query = new WP_Query('category_name=favorites');
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate[] = $post->ID ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
</div>
<div id="left-column">
<?php $my_query = new WP_Query('category_name=Recents');
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate[] = $post->ID ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
</div>
Change your right-column and left-column from a width of 270px to a width of 50%. Then when your window is above 600pixels (most modern phones), you'll still see two columns.
I.e. edit your style.css (not the main theme style.css) and change:
div#left-column {
width: 270px;
float: left;
clear: none;
}
div#right-column {
width: 270px;
float: right;
clear: none;
}
to:
div#left-column {
width: 50%;
float: left;
clear: none;
}
div#right-column {
width: 50%;
float: right;
clear: none;
}
though you may want to add a little padding/margin room after doing this.
Is that what you're looking for?
I am new at cakephp 1.3. I am trying to create an Edit User Form with Form Helper in Cakephp 1.3.
I am unable to customize the alignments of the form elements, for example:
echo $this->Form->create('Model', array('action' => 'edit_users','id' => 'UserForm'));
echo $this->Form->input('First Name',array('style'=>'width:100px','label'=>'First Name:'));
echo $this->Form->input('Last Name',array('style'=>'width:100px','label'=>'Last Name:'));
echo $this->Form->input('Position',array('style'=>'width:100px','label'=>'Position:'));
I want the first two input fields on a single line and the third input field on the second line. I have tried it with div false, but its not working. How can I achieve this?
div=>false works but you will need to add some css
echo $this->Form->create('Model', array('action' => 'edit_users','id' => 'UserForm'));
echo '<div id="first">';
echo '<div class="leftalign">';
echo $this->Form->input('First Name',array('div'=>false,'label'=>'First Name:'));
echo '</div>';
echo '<div class="rightalign">';
echo $this->Form->input('Last Name',array('div'=>false,'label'=>'Last Name:'));
echo '</div>';
echo $this->Form->input('Position',array('style'=>'width:100px','label'=>'Position:'));
CSS
#first .leftalign{
float: left;
width:300px;
}
#first .rightalign{
clear:none;
float: right;
width:300px;
}
#first label,#first input{
width: 100px;
}
You can edit the css as per your requirements
this one worked for me
<table border='0'>
<tr><td>
<?php echo $this->Form->create('Model', array('action' => 'edit_users','id' => 'UserForm'));
echo $this->Form->input('First Name',array('label'=>'First Name:'));?>
</td><td>
<?php echo $this->Form->input('Last Name',array('label'=>'Last Name:'));?></td>
</tr>
<tr><td>
<?php echo $this->Form->input('Position',array('label'=>'Position:'));?>
</td>
</table>
Just put your form controls in a table and you can align them on the form any how you want!
I am using cakephp and here is my sample code below along with the css i am doing
<div class="thumbs">
<?php if(!empty($auction['Product']['Image']) && count($auction['Product']['Image']) > 0):?>
<?php foreach($auction['Product']['Image'] as $image):?>
<?php if(!empty($image['ImageDefault'])) : ?>
<span><?php
echo $html->link(
$html->image('default_images/'.$appConfigurations['serverName'].'/thumbs/'.$image['ImageDefault']['image']),
'/img/'.$appConfigurations['currency'].'/default_images/max/'.$image['ImageDefault']['image'],
array('class' => 'productImageThumb'),
null,
false);?>
</span>
<?php endif; ?>
<?php endforeach;?>
<?php endif;?>
</div>
.thumbs span //css for how to display the images
{
float:left;
width:75px; //this displays two images as a thumbnail in a single row
margin:12px;
border-right:1px solid #d5d5d5;
padding:3px;
}
My problem is i want to do css border-right:none for all the images having count as even numbers. I tried using for loop in the span of my code but not getting the result. Please suggest me how to dynamically do css border-right for only thumb images of odd number count and not for even numbers.
Add the key to the foreach loop and add a new class to odd images using the key (assuming this is a standard Cake query result where the key reliably increments by one):
foreach( $auction['Product']['Image'] as $key => $image ):
$odd = ( $key % 2 ) ? ' oddImage' : '';
....
array( 'class' => 'productImageThumb'.$odd ),
....
.oddImage {
border-right:1px solid #d5d5d5;
}
(Protip: You don't have to wrap every line of PHP into <?php ... ?> tags. The code will be much more readable if you close the PHP tags only when you need to output pure HTML.)
I have been looking at the Cookbook - 7.3.3 Automagic Form Elements trying to find a way for radio buttons to line up horizontally rather than vertically. I have been looking at the 'div' => 'class_name' $options also the $options[‘between’], $options[‘separator’] and $options[‘after’] but have been unsuccessful. Is there a "cake" way of doing this?
<?=$form->input('Product Type', array(
'type' => 'radio',
'id' => $tire['ProductType']['id'],
'name' => $tire['ProductType']['id'],
'options' => array(2=>'Tire Manufacturer', 7=>'Rim Manufacturer '),
));?>
The of equivalent this
<label>Product Type</label>
<div style="padding-top:5px;">
<input type="radio" name="data[Manufacturer][product_type_id]" value="<?=$tire['ProductType']['id']?>"> Tire Manufacturer
<input type="radio" name="data[Manufacturer][product_type_id]" value="<?=$wheel['ProductType']['id']?>"> Rim Manufacturer
</div>
This works for me:
Inside your view file (viewfile.ctp):
<div>
<?php
echo $this->Form->create('changeRegion');
$options=array('US'=>'U.S.','CA'=>'Canada', 'FN'=>'International');
$attributes=array('legend'=>false, 'label'=>false, 'value'=>'US', 'class'=>'locRad');
echo $form->radio('subLocation',$options,$attributes);
echo $this->Form->end();
?>
<div class="clear"></div>
</div>
Make sure 'label'=>false and 'legend'=>false are set in your attributes.
In your stylesheet:
input[type=radio] {
float:left;
margin:0px;
width:20px;
}
form#changeRegionStdForm input[type=radio].locRad {
margin:3px 0px 0px 3px;
float:none;
}
I fought this forever because of the default CakePHP style rule for input[type=radio] (inside the app/webroot/css/cake.generic.css file) was always taking precedence. I generated another rule to specifically pick out the radio group in question by referencing the form along with the radio input rule appended with the class name (form#changeRegionStdForm input[type=radio].locRad). I initially did this with the form# rule listed before the input[type=. Only when I moved it after the input[type= did the radio buttons line up horizontally.
I hope this makes sense and actually helps someone else.
The easiest way to do this is to put each radio button inside an 'LI' tag, and then apply CSS styles to the 'UL' that tells it to show 'LI' tags horizontally instead of vertically. You can find a lot of horizontal list designs here.
I found this post very late. But i thought others might stumble upon this like i did now.
Try something like this:
<ul id="hMenu"><li>
<?php
$attributes=array('legend'=>false, 'separator'=>'</li><li>', 'label'=>false);
$form->input('Product Type',$options, $attributes);
?>
</li></ul>
Now style the id hMenu. That should solve this problem.
This without any styling gives verical radio buttons. But if you use css styling on ul and li you could literally make it stand on its head! :)
use this:
$form->input('Product Type', array(
'type' => 'radio',
'id' => $tire['ProductType']['id'],
'name' => $tire['ProductType']['id'],
'options' => array(2=>'Tire Manufacturer', 7=>'Rim Manufacturer '),
***********************
'seperator' => '<br />'
***********************
));
which result look like this :
<label>Product Type</label>
<div style="padding-top:5px;">
<input type="radio" name="data[Manufacturer][product_type_id]" value="<?=$tire['ProductType']['id']?>"> Tire Manufacturer
<br />
<input type="radio" name="data[Manufacturer][product_type_id]" value="<?=$wheel['ProductType']['id']?>"> Rim Manufacturer
</div>
Try this, I got my code working through this..
<ul id = "navlist">
<fieldset>
<legend><?php echo __('Insert User'); ?></legend>
<li><?php //echo $this->Form->input('Site', array('options' => $arraycharges));?></li>
<li><?php echo $this->Form->input('MobileApp', array('options' => array('admin' => 'Admin', 'user' => 'User')));?></li>
<li><?php echo $this->Form->input('Location', array('options' => array('admin' => 'Admin', 'user' => 'User')));?></li>
<li><?php echo $this->Form->end(__('GO')); ?></li>
</fieldset>
</ul>
in the style sheet add the following..
#navlist li {
display: inline-block;
list-style-type: none;
padding-right: 20px;
}
You an follow like this :
<ul>
<li style="width: 200px;float: left;list-style: none">
<?php
$attributes=array(
'legend'=>false,
'after'=>'</li>',
'separator'=>'</li><li style="width: 200px;float: left;list-style: none">',
);
echo $this->Form->radio('xyz_name',$myOptions,$attributes);
?>
</li>
</ul>