HTML Block Images
Permalink 2 users found helpful
Hello to everyone.
This is my first question and first of all im from Chile, so my english is not very good, but i will try.
I can not place an image correctly in the "HTML Block".
I tried with:
and
and does not work any of them.
I have read that the "HTML block" does not read PHP code. Is it true?
PLS HELP!!
I DONT WANNA USE this:
http://www.xxxx.com/concrete/files/5813/3896/7879/xxx.png...
Thanks!
This is my first question and first of all im from Chile, so my english is not very good, but i will try.
I can not place an image correctly in the "HTML Block".
I tried with:
src="<?=$this->getThemePath()?>/images/image.png">
and
src="<?php echo DIR_REL; ?>/images/image.png"
and does not work any of them.
I have read that the "HTML block" does not read PHP code. Is it true?
PLS HELP!!
I DONT WANNA USE this:
http://www.xxxx.com/concrete/files/5813/3896/7879/xxx.png...
Thanks!
First, unless you have requirements you have not told us, you can use an image block and then use block design to make it look as you want. That would probably be the best solution.
As you have read, the html block does not process php. So you need to write the full html for your image.
If this is a one off, you can create an image block, view the source or developer console to get the image path, then delete the image block and code the image path into your html block. (What you don't want to use). You can then add javascript to your html block to do the equivalent of the php DIR_REL.
If it is a more complex html block, you are using it more than once or need to change the image, then you could use Designer Content to create a block that displays your image and edit the view of the generated block to add your html.
As you have read, the html block does not process php. So you need to write the full html for your image.
If this is a one off, you can create an image block, view the source or developer console to get the image path, then delete the image block and code the image path into your html block. (What you don't want to use). You can then add javascript to your html block to do the equivalent of the php DIR_REL.
If it is a more complex html block, you are using it more than once or need to change the image, then you could use Designer Content to create a block that displays your image and edit the view of the generated block to add your html.
The problem is what to do when you want to move the website to another hosting and need to edit all images of "HTML block" or the images of the any jquery plugin (sliders, etc...).
Thanks for you answer John
Thanks for you answer John
By using DIR_REL (php) or CCM_REL (JavaScript) to build a path, then paths remain independent of the domain or subdomain. If you search for these symbols in .php and .js files beneath the /concrete folder you will find plenty of examples.
For most sliders or galleries, the easy answer is to build your block to use a fileset.
For most sliders or galleries, the easy answer is to build your block to use a fileset.
I'm sorry for bother you man, but you have a guide o more information about how works and how implement "CCM_REL" JAVASCRIPT?
Thanks for your time.
Thanks for your time.
On every page Concrete5 provides a bunch of JavaScript global constants that any script on the page can use to make it independent of the host url. Below is how they are set for the home page of my site http://www.c5magic.co.uk
In the case of my site above, CCM_REL is null because the URL points to the root of my site.
On an offline development copy of the site, the equivalent line for CCM_REL is:
By copying the /files folder and databases between the sites, the paths within /files are identical.
If I have an image at /files/1234/5678/9101/mypic.jpg, it will be in this folder for both sites.
I could then code a site independent path to it using
If my site moved to another host, or to a subdirectory, I would not need to change the code.
<script type="text/javascript"> var CCM_DISPATCHER_FILENAME = '/index.php'; var CCM_CID = 1; var CCM_EDIT_MODE = false; var CCM_ARRANGE_MODE = false; var CCM_IMAGE_PATH = "/concrete/images"; var CCM_TOOLS_PATH = "/index.php/tools/required"; var CCM_BASE_URL = "http://www.c5magic.co.uk"; var CCM_REL = ""; </script>
In the case of my site above, CCM_REL is null because the URL points to the root of my site.
On an offline development copy of the site, the equivalent line for CCM_REL is:
var CCM_REL = "/cms/development552";
By copying the /files folder and databases between the sites, the paths within /files are identical.
If I have an image at /files/1234/5678/9101/mypic.jpg, it will be in this folder for both sites.
I could then code a site independent path to it using
var href=CCR_REL+'/files/1234/5678/9101/mypic.jpg';
If my site moved to another host, or to a subdirectory, I would not need to change the code.
PS. The other CCM_ constants have similar uses from scripts.
Thanks for the answer my friend, i will try that.
ADD-ONS
Simple PHP block and Code Blocks
and nothing :(