Add image to label (or alongside it) using FormHelper - cakephp-3.0

I have an image that i want do display alongside with the label.
<?php
echo $this->Form->input('ticketdays',['label'=>'Ticket days']);
?>
<img src="/img/help-round-button.png">
This is what happens now. I want do display it where the blue "circle" is.
How to achieve this? I accept any solution I can get. Already searched stackoverflow and Google and didn't find the answer.
Thanks.

Try something like this:
<div>
<label>Ticket days</label>
<span style="top:50%" class="glyphicon glyphicon-info-sign"></span>
<?php
echo $this->Form->input('ticketdays', ['label' => false]);
?>
</div>

Related

problem with custom url to the featured image

I have used a wordpress plugin (Add Featured Image Custom Link) to insert custom url to the featured image.
I have two functionalities in my portfolio:
when the user click on image it will popup the image; this is working properly.
the anchor tag I have used for the link which I have added to featured image I want to redirect to the website of which I have added the link on featured image
How do I do #2
<div class="option inner">
<div>
<h5><?php the_title(); ?></h5>
<?php
$url = get_the_post_thumbnail_url(get_the_ID(),'full');
?>
</div>
</div>
If you want to get the input from the (Add Featured Image Custom Link) WordPress Plugin it's easy. This code will add the link if the input is not empty.
<div class="option inner">
<div>
<h5><?php the_title(); ?></h5>
<?php
$cust_li_fi_value = get_post_meta( $post->ID, '_custom_url_image', true );
if( $cust_li_fi_value ) { ?>
<?php }
?>
</div>
</div>
Cheers,
Happy Coding :)
I got my solution by one way i think it is not the proper way
that is, inplace of i wrote the funciton the_content
and inside editor of the wordpress i use the custome html like this

Insert tag a right after img

Have look on this code:
<a href="#" class="list-group-item">
<span class="badge"><?=$st ?></span>
<img class="small_profile_pic" src="<?=$pic ?>" /> aaa<?=$msg['UserName'] ?> :
</a>
this is a row that show a message in short type. in this row I need to <?=$msg['UserName'] ?> be after image but it going to next line.
when I type word without a tag its OK but links goes to next line. How do I fix this?
more explanation on this pic:
Please notice that I can't use float, if there is another way except float please tell me that.
Edited:
(I have fixed that place by changing parent tag to span but ...)
I need to make whole row a link to that specific message and make username a link to user profile. Who can I place links inside each other?Or another solution maybe?
Second Edit
I have placed a tags inside each other and both of them works well but still second a tag goes to next line! I have tried display:inline but whole row collapsed!
You can't use 'a' tag in "a" tag .... but just for you If you want to align it after image use style property and use ,
<a href="#" class="list-group-item">
<span class="badge"><?=$st ?></span>
<img class="small_profile_pic" src="<?=$pic ?>" style="display:inline" /> aaa<?=$msg['UserName'] ?> :
</a>

Yii2 - Why is an image not shown on subpages

In layouts\main.php I added an image which should be shown on every page at the same place (header). I added following code in main.php (layout):
...
<div class="intl">
<a href="http://www.example.org" target="_blank>
<img src="../files/wsk/design/intl.png" alt="Text" align="right"> </img>
</a>
<br>
International
<div>
...
The image is shown on the homepage but not on subpages like About or Contact as shown on the pictures attached. Would be glad if anybody could tell me why.
This is because you used related path for image (with ..).
It's recommended to place such images in web accesible directory (web), in subfolder images for example, then access it like that: /images/design/your-image-name.jpg.
If your image is outside of web accessible directory, alternatively you can use assets to publish it there.
Looks like it might be to do with using the relative URL in your img tag. Try this:
<img src="<?php echo Yii::app()->baseUrl; ?>files/wsk/design/intl.png" alt="Text" align="right">
If that still doesn't work, check your baseUrl in your configuration is correctly pointing to the folder with your index.php to make sure your URLs are all resolving properly.
In your layouts/main add Html helper
<?=
use yii\helpers\Html;
?>
Now you can display the image by
<?= Html::img('path/to/your/imagefile', ['alt' => 'text', 'height' => '28', 'width' => '112']) ?>
or you can create a uploads folder in the root of the project and create an alias for it. That will make your job easy for image display in all the pages. You can use the below code to display an image if alias is set for uploads folder
<?= Html::img('#uploads/imagefile', ['alt' => 'text', 'height' => '28', 'width' => '112']) ?>

Wordpress Page.ly MultiEdit Plugin Not Working

I'm trying to use the Wordpress page.ly MultiEdit plugin here:
http://wordpress.org/extend/plugins/pagely-multiedit/
I can't get it to work correctly. I get an error:
Bottom, Left, Bottom, Left region(s) are not declared in the template.
Here's a screenshot.
Here is the code for the template file I created:
<?php
/*
Template Name: Home
MultiEdit: Right
*/
?>
<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="content">
<?php the_content(); ?>
</div>
<div class="sidecontent">
<?php multieditDisplay(‘Right’); ?>
</div>
<?php endwhile; endif; ?>
<?php get_footer(); ?>
Am I missing something?
Thanks.
I guess I didn't look at your code close enough. You're not calling them twice in the code, you're just not calling them at all. You can still follow the instructions in my answer and it will work.
Couple things here. It looks like you're calling the same two content blocks twice in the same page template. You can't do that. Each one has to have its own unique name. If you're simply trying to get "bottom', "left", and "right" you need to change you're comment code at the top of the page template.
Use this:
/*
Template Name: Home
MultiEdit: Bottom,Left,Right
*/
Then place these where you want the content to be displayed in your page template:
<?php multieditDisplay('Bottom'); ?>
<?php multieditDisplay('Left'); ?>
<?php multieditDisplay('Right'); ?>
Before you do any of that though, click on the "Screen Options" tab in the top corner of the admin page for your home page editor. Then click on the "Custom Fields" option. Then scroll down until you see the "Custom Fields" area and expand it. Then click on the "Show/Hide Multiedit Fields" so that you can see the ones you currently have in there. You need to delete each one of them to clear them from your editor. Follow these instructions and it will work, its an amazing plugin that I've used many times with great success. Once you fix it, please accept my answer. Let me know if you have any other issues with it.
Also, you don't need to use the call inside of a loop, just drop in the one of the three calls where you need it to be in the template. In fact, I'd recommend not using it inside of a loop.

Related Posts code causing wrong post comments to load in Wordpress

I've been trying to show a related posts segment using wordpress.
My intention is to align an adsense block and 5 random posts adjacently under the post, and above the comments.
After a lot of trial and error, I was able to work something out that seemed to align well, and not affect any other part of the post layout.
Now I see that the comments aren't loading right. The post loads the wrong comments from another post randomly. I understand that I'm calling for additional posts in the related posts code, but is there anyway to load the main post comments instead of random comments from the random posts shown?
I'm just not able to figure it out. I'm new to this, and didn't want to mess with css stylesheets, so I've made all the changes in the single.php itself.
<div style="width: 575px;">
<div style="float: left;width: 250px;height: 250px;">
<250x250 adsense code>
</div>
<div style="float: right;width: 310px;height: 250px;margin: 0px;list-style: none;line-height: 1.5em;font-size: 1em;font-weight: bold;font-family: verdana, sans-serif;margin-left: 10px;padding-top: 10px;">
<?php $posts = get_posts('orderby=rand&numberposts=5'); foreach($posts as $post) { ?>
<li><span style="color: #0000FF;"><?php the_title(); ?></span>
</li>
<?php } ?>
</div>
<div style="clear: both;"></div>
</div>
Any help will be deeply appreciated. Thank you!
The reason maybe is that the $post variable stores the information of the post you are currently viewing. Your foreach loop then changes the $post variable. In fact, you may find that the comments appearing are for the last post in your 'related posts' section.
To get around this, before your foreach statement, put:
$temp = $post;
and then afterwards, reset the $post variable, by putting
$post = $temp;
If this doesn't work (put global $post; before the $temp=$post; line).
Hope this helps!