How can I access images into plugin in cakephp 2.*? - image

I saved my plugin images in here:
app/plugin/my-plugin-name/webroot/img/...
now :
I want to access theme same as $this->Html->image(path)
what is your plan for this?
thx

You can use:
$this->Html->image('My-Plugin-Name.image.png');
See also http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::image

When I need to include a CSS from a folder outside CSS, I use this, it may work in your case
$this->Html->image(array('../../plugin/my-plugin-name/webroot/img/imagename');
Anyway, you can also use absolute routes
$this->Html->image(APP . 'plugin/my-plugin-name/webroot/img/imagename');

Related

need to add css,js files inside the modules folder CI hmvc

I am working on a CodeIgniter - HMVC
What I know:
is I should not create assets like css,js,images inside the application folder in codeigniter, but I have a necessity for it.
**What I am trying to achieve is : **
to create a standalone module and trying to use it in another project. In that case, I really need to add the necessary css,js,images files into the modules folder it self.
The Error I get is:
You don't have permission to access /v7-bitbucket/application/modules/some_modle/assets/bootstrap.min.css on this server.
How do I overcome this?
Please advice.
Thanks.
There are 2 ways I can think of for you to access this data.
The first one is using an htaccess and a custom rule, which redirects certain files to inside the other directory. This way, the user will still have access to only certain specific files outside of the public HTML folder.
The second option is to use PHP and render the content of the file in custom tags.
Ex: Instead of entering <link href="<?= $path ?>">, you would do <style><?= file_get_contents($path) ?></style>. This would be harder to cache, and a bit harder to implement for images.

local images are not displayed, in octopress

I create a post and hope to display some local images, so I put some images in the folder of source/images/my_dir/image.jpg
And then I use the following two ways to display the pictures.
![method 1](../images/my_dir/image.jpg)
![method 2](http://my_username.github.io/my_dir/image.jpg)
And then I generate the post and deploy to github page.
I can see that the images is copied in the folder of _deploy/images/my_dir/
But method 1 is not working, instead, method 2 is working. Why is that?
PS:I am using windows7 to write the post in markdown pad.
In your atom.xml all img src must be of the form ![method 2](http://my_username.github.io/my_dir/image.jpg). Feeds reader must have resources full urls to display them correctly.
In your post it's ![method 1](/images/my_dir/image.jpg)
Apparently, jekyll is enabled by default and will skip directories that begin with "_". To disable the behaviour, drop an empty file named ".nojekyll" in the root dir.
More info here
Yes, it drove me mad too.

Magento merge javascript omit files

I've found that prototype.js messes up some things whenever I merge javascript on my store. Is there a way to have Magento omit prototype.js when it merges javascript files? I assume I could rewrite whatever function does this, but I'm not sure how to find where this happens. Is there a good way to find what is happening and where in Magento?
You can omit a file from being combined by adding a param. For example, in your page.xml you could change the following line:
<action method="addJs"><script>prototype/prototype.js</script></action>
to:
<action method="addJs"><script>prototype/prototype.js</script><params>prototype</params></action>
All files with the same param are combined together.
The magento merging system does n't work well in a lot of cases. I think for better understanding u should check Here
There is not an option to exclude a file from admin panel but i guess u can separate them by using grouping technology mentioned in the above blog.
Instead of using the default merging system i suggest u sld try FooMan Speedster
install mod_pagespeed by google on server zero configuration for your magento.
Try to load prototype.js link in head.phtml file. This way don't merge your file, and you don't need to add it via xml.
It is not the best practice anyway, but it works perfectly.

CKFinder Not Actually Uploading Images

I am using CKEditor + CKFinder to create a blog post with images in a custom CMS. The issue is that CKFinder isn't actually uploading the images to the directory I have stated in my config file. The path is correct but the uploading doesn't actually take place.
Anyone have experience with this?
Did you follow this guide? You have to set the $baseUrl and $baseDir, and set CheckAuthentication.
Its seems your having difficulty trying to install/config some of the file managers you mention in this post and others.
Might I suggest a really easy file manager to install:
an-open-file-manager-for-ckeditor-3-0
It even lets you take care of your own security/authentication
Initializing is as easy as:
CKEDITOR.replace('wysiwyg', {
filebrowserBrowseUrl: 'ckeditor/Filemanager/index.html'
});

Magento - $this->getSkinUrl() returns Wrong theme in homepage

I use a template with 3 columns in homepage, in my file right_col.phtml I use "$this->getSkinUrl()" and that returns me the wrong theme: /default/default/ instead of /default/my_second_theme, but it works good in all other pages.
How can I fix this problem to get the good theme??
Thanks a lot.
Also make sure that the asset actually exists (or that you specify an existing path). If an asset is not found in any theme, Magento will always use default/default as the resulting skin path.
Check the CMS page for the home page, go to the Design tab, and make sure that you didn't set the "Custom Theme" to something that is overriding the theme that you want to use.
Check the $argument you are passing and verify that the target file actually exists. getSkinUrl() does more than just generate the proper URL, it also verifies that the file exists. If it doesn’t find the file within the store’s /default/my_second_theme folder, it will revert to /default.
Refer to: http://www.nvncbl.com/2009/10/magento-this-getskinurl-wrong-template/
I have used this to solve it :
if (Mage::app()->getStore()->getCode()=='deutsch') {
Mage::getDesign()->setTheme('deutsch');
}
It works good now ;)

Resources