CakePHP htmlhelper::image adds atribute class depending on the referenced image folder - html

I try to display an image with the following code.
<?php echo $this->Html->image('/img/adverts/001/ad.jpg', array('alt' => 'ad')); ?>
this creates me this:
<img class="zdrwtxgldzisqmpzuclb" src="/img/adverts/001/ad.jpg" alt="werbung">
I don't know where this strange class atribute is comming from but it seams to ruin my code as the picture is not displayed.
Now if I use another sub folder in webroot/img, the sub folder uploads like this:
<?php echo $this->Html->image('/img/uploads/001/ad.jpg', array('alt' => 'ad')); ?>
it works and gives back an <img> tag without that class.
<img src="/img/uploads/001/ad.jpg" alt="werbung">
So the question is, where does this class attribute come from, and is this the reason why no image is displayed? I can't find anything about that effect and where it is coming from.
If I add a class attribute to my CakePHP code then it just appends this strange string after my class attribute.
<?php echo $this->Html->image('adverts/01/ad.jpg', array('alt' => 'werbung', 'class' => 'img' )); ?>
<img src="/img/adverts/01/ad.jpg" alt="werbung" class="img zdrwtxgldzisqmpzuclb">
Of course the both folders uploads and adverts have the same rights.
Edit: ndm was right, it is an ad-blocker. Shocking, I didn't know they are that clever.

ndm was right. It was the ad blocker "Adblocker Plus" that caused that effect.
The problem is solved.

Related

ACF fields in another plugin

I need to add additional images next to post title, in this case decided to use ACF and add fields (image) into another plugin (Event Schedule). After I added fields in ACF I was trying to add some code from ACF documention however it doesnt work..
P.S. Every post will have different images based on their type. You can choose it while you are editing specific post.
In ACF field menu I chose to return format Image Array.
Tried with all return formats: Image Array, Image URL and Image ID. As I understand plugin cant find the variable acf_name and the image source is left blank.
<div class="wcs-class__meta">
<div class="wcs-class__inner-flex">
<h3 class="wcs-class__title" :title="event.title" v-html="event.title"></h3>
// Using this code from official ACF documentation
<?php
$acf_name= get_field('acf_name');
if( !empty($acf_name) ): ?>
<img src="<?php echo $acf_name['url']; ?>" alt="<?php echo $acf_name['alt']; ?>" />
<?php endif; ?>
</div>
</div>
Now nothing happens, no errors, nothing. However, also it doesnt show those images I want.
Files in the plugins folder do not have access to global functions like get_field();. You can overwrite most plugin files in your theme, in which you should have access to global functions. Keep in mind that when the plugin you override gets updated, the file your are overriding will not. This could cause security issues.
The following article talks about the right ways of custmizing plugins: https://iandunn.name/2014/01/10/the-right-way-to-customize-a-wordpress-plugin/

Yii2 Create & use variable with views folder scope

I am trying to create a Yii2 theme, & would like to set a variable that with scope of the entire views folder. For a single page theme I used...
$assetDir = Yii::$app->assetManager->getPublishedUrl(
'#vendor/path/to/assets/folder'
);
in index.php & I then I accessed it using...
<img src="<?= $assetDir ?>/img/image.jpg" alt="">
For partials I am able to pass that using...
<?= $this->render('_partial.php', ['assetDir' => $assetDir]) ?>
I am now wanting to do similar in a theme with multiple pages & cannot find how to do that without setting $assetDir in each page. I imagine it would be set in the main.php layout.
Use params array for this as stated in Sharing Data among Views.
The view component provides the params property that you can use to share data among views.
For example, in an about view, you can have the following code which specifies the current segment of the breadcrumbs.
$this->params['breadcrumbs'][] = 'About Us';
Then, in the layout file, which is also a view, you can display the breadcrumbs using the data passed along params:
<?= yii\widgets\Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>

Locate and edit the main HTML file in magento store

I need to add a shadow effect png picture to the top banner in my Magento website tamween.biz, I could do this on my local server using firebug by adding a new class in the right coding area and I have made all selector properties in the bootstrap.css file.
This test was very successful, The problem is I don't know where to locate the real HTML file in the server to edit these changes?
HTML code that calls image is in root/app/design/frontend/<package>/<theme>/template/page/html/header.phtml
Image's path is stored in System => Configuration => General => Design => Header => Logo Image Src
Any skin is located in root/skin/frontend/<package>/<theme>/css
Magento HTML page is made up of blocks, and each block has a template file.
To find out where each block template file is you can add some code to the core and get rid of it after you are done.
Open app/code/core/Mage/Core/Block/Template.php:241. This should be in the method fetchView and then edit the line having the include code to the following
if (strpos($includeFilePath, realpath($this->_viewDir)) === 0 || $this->_getAllowSymlinks()) {
echo "<!-- template hint start\n";
echo $includeFilePath."\n";
echo get_class($this)."\n";
echo "-->";
include $includeFilePath;
echo "<!-- template hint end\n";
echo $includeFilePath."\n";
echo get_class($this)."\n";
echo "-->";
} else {
This will add HTML comments telling you about the template file path and what $this means in that context.
(Reference)
In magento go to System - > configuration and set template hints yes.
This way you will see each template section from where static blocks will come from.
If you have created your custom theme then go to
root/app/design/frontend//yourtheme/template/page/html/header.phtml
if not then go to
root/app/design/frontend/base/default/template/page/html/header.phtml
and the n search for
<img src="<?php echo $this->getLogoSrc() ?>">
this is the code that output the image.you can add css class to it.

Adding image src path in cakephp

Iam creating an image link in cakephp using html tag, i have a problem with adding src path.
I tried
<a href="#today1" id="lnk3">
<img src="/iserprofiles/app/webroot/img/todaysallocation.png">Todays Allocation</a>
but image is not loaded. if anybody know please reply. i know that we can also create image link using cakephp, but i faced one problem
i u sed this code
<?php echo $this->Html->link($this->Html->image('todaysallocation.png',
array('width' => '200', 'height' => '45')) ,
'#today',array('escape' => false));?>
i dont want to use any controller or action as url, simply i just added '#today',
but my problem is i need to add one id for this. how can we done this????
Check in Your browser patch: localhost/iserprofiles/app/webroot/img/todaysallocation.png
, but i think the problem is in Your .htaccess file, because path to image will look like localhost/iserprofiles/img/todaysallocation.png

Cakephp Link is not recognized in HTML

I generate in Cakephp with Html->link a link
echo $this->Html->link('Download',array(
'plugin'=> 'galleries',
'controller'=> 'galleries',
'action'=> 'download',
$download),array('class'=>'down'));
The output is
Download
This link is not recognized. I can not click on it.
But if I put the output link and implement it in the HTML code, all is fine
After this I tried to echo the link - same problem.
This is a snippet from my view
<nav>next<?php if($download){ echo $this->Html->link('Download',array('plugin' => 'galleries', 'controller' => 'galleries','action' => 'download', $download),array('class'=>'down')); } ?>prev</nav>
Maybe somebody can give me a little hint?
Solution:
It was not a PHP Problem but CSS Problem... specially a z-index Problem in my Jquery Plugin (ImageViewer) rolleyes
The schemata of the HTML is:
<article><div class="info"><nav></nav</div></article><article><div class="info"><nav></nav</div></article><article><div class="info"><nav></nav</div></article>
The Problem were the nav tags in every article tag. The "prev&next" links appear in every nav structure but not the "download" link. ergo: i can click on the "prev&next" links but not on the "download" link... So, for a fast solution i set the z-index for my current article view. But i must rework my HTML Code structure
Thanks for reading my question.