Is there a way to post html code to a block/region?
superflyman
Joined: 2009-11-12
Posts: 24
Posted: Sat, 2010-01-02 00:59
I'm probably just overlooking something but I want to add some html code for widgets in a couple blocks to display in the sidebar and header. Is there a way to create ad-hoc blocks to do this?
In the next few days I should be able to whip up a module for this. In the mean time you could use: http://codex.gallery2.org/Gallery3:Modules:share_bookmark
and edit the view file that shows the html/JS code for a sidebar block.
Actually, aside from the template issue this brings up an interesting question. Is there a way to create multiple code blocks in a sidebar?
floridave
Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2010-01-20 06:44
You could duplicate the code_block module and edit it to be code_block2 and you will have created your own module.
If you get stuck I can whip another up for you.
I guess I should learn how to add 2 blocks with one module.
Glad it is working out. I was thinking of adding a some checkboxes on the admin page to allow the admin to select what type of page to show the block on; album. movie, photo, all.
Think that is a good idea?
We have 2 js codes that want to add in 1 block, but that they were loaded in turn (not together) after pressing F5 in the browser.
floridave
Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2010-01-22 17:22
I don't think I could do that. Are you thinking something along the lines of a random advertisement?
Got an example of this working outside gallery I can see?
Bug: As of 3.0 Beta 3, every time you click save in admin, it double escapes all special characters. The first time you save, a ' becomes \' , the second becomes \\\' , the third becomes \\\\\\\' ... and so on and so forth.
floridave
Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2010-02-15 21:15
Can you give an example?
Try the lateest version of G3. It was not tested against B3.
Ok, I updated to latest version of Gallery3 and got the ads to work by downloading, installing, activating and finally editing the (views files) and http://www.nigerianfolks.com/gallery is now at it,s uptimum as i would want it.
Way to go folks.
I promise to donate to this course in the nearest future.
Pretenders are people who lack self confidence...
Ser Moro
Joined: 2007-12-08
Posts: 79
Posted: Thu, 2010-06-10 16:53
The multiple code blocks works OK.
However, gallery pages have several <div id="g-metadata" class="g-block">
and don't validate by validator.w3.org
-=SM=-
Tried it on RC1, error is there, solved it for myself by putting everything in the code_block.html.php file
you can see it here, code block is called test 2
mystavash
Joined: 2004-09-12
Posts: 69
Posted: Sun, 2010-12-12 03:21
floridave,
To me the instructions were confusing. With the code block, you would normally add the code into the UI. However, for php/jsp, you're saying that that code should be added directly into the files. That's not how I understood it. I thought there was some kind of setting in the files that would allow you to enter php/jsp into the UI. So it was confusing. Just "edit the file" is not enough, it would be great if it said 'edit the file to add the desired php/jsp directly into the code block" or something like that.
Anisa.
floridave wrote:
Fader the module instructs you to edit:
modules/code_block/views/code_block.php
.
For example I did:
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?= module::get_var("code_block", "code"); ?><br />
<SCRIPT language=JavaScript>
<!---
var now=new Date();
document.write("The Time is "+now);
// --->
</SCRIPT>
and it wrote the suff I saved as well as the "The Time is"
then the time.
"
How can we be more specific that that?
OK on the left side you will see your Code Block. Below the heading NAVIGATION you will see three links. I want those to hover if possible: http://www.dwdallam.com/G3_DWDALLAM/
I'm probably just overlooking something but I want to add some html code for widgets in a couple blocks to display in the sidebar and header. Is there a way to create ad-hoc blocks to do this?
Posts: 27300
In the next few days I should be able to whip up a module for this. In the mean time you could use:
http://codex.gallery2.org/Gallery3:Modules:share_bookmark
and edit the view file that shows the html/JS code for a sidebar block.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 27300
New module
attached:in the codex:http://codex.gallery2.org/Gallery3:Modules:code_block
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 24
Wow, that was super fast! thanks! I added the module but I'm not sure where to configure it... Do I edit the code_block.html.php file itself?
Posts: 27300
Yes. In the future I might add a UI to have a admin page, but since this is a one off deal most people will be comfortable editing a single file.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 24
ok, sounds good, thanks again!
Posts: 27300
Care to take a shot at doing some documentation for this new module?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 24
Yes, I will do my best to write something up... I'll get back to you soon.
Posts: 27300
Just edit:
http://codex.gallery2.org/Gallery3:Modules:code_block
as you see fit
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 15
Could you provide example for php/js inserts for dummies?
Posts: 27300
Fader, I don't understand. This is not the place to learn JS and php.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 15
This misunderstanding.
I don't understand - how to insert code like php/js.
How to edit code_block.html.php file? For example?
Posts: 27300
Fader the module instructs you to edit:
modules/code_block/views/code_block.php
.
For example I did:
and it wrote the suff I saved as well as the "The Time is"
then the time.
"
How can we be more specific that that?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 15
all ok. thanks!
P.S. Sorry for offtopic, but maybe you explain me - how to change the template to add second sidebar on the left side? Or link for this?
I want use your plugin both sides.
Thanks in advance!
Posts: 27300
Please start a new thread.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 24
Actually, aside from the template issue this brings up an interesting question. Is there a way to create multiple code blocks in a sidebar?
Posts: 27300
You could duplicate the code_block module and edit it to be code_block2 and you will have created your own module.
If you get stuck I can whip another up for you.
I guess I should learn how to add 2 blocks with one module.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 27300
New module attached:
http://gallery.menalto.com/node/93525#comment-331498
it now has 3 independent blocks to add/reorder.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 39
Great solution for custom blocks.
How can I get the code block to show on all pages? For example, code block is not showing on Contact Owner or Dynamic Album pages
Posts: 27300
Replace the existing file code_block_block.php
with the attached renameing it to code_block_block.php
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 39
Perfect. Thanks Floridave.
Posts: 24
The multiple code blocks works great! Thanks!
Posts: 27300
Glad it is working out. I was thinking of adding a some checkboxes on the admin page to allow the admin to select what type of page to show the block on; album. movie, photo, all.
Think that is a good idea?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 15
Yes of couse.
I have idea too:
to add code rotate for block (if use js/php script). -> after refresh page this module will load next code from list.
Its really release?
Posts: 27300
I don't really understand, can you explain with a example?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 15
example:
We have 2 js codes that want to add in 1 block, but that they were loaded in turn (not together) after pressing F5 in the browser.
Posts: 27300
I don't think I could do that. Are you thinking something along the lines of a random advertisement?
Got an example of this working outside gallery I can see?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 15
Right. this used for random advertisement.
I have not exapmle for outside gallery, but there is Ad Rotator plug-in for Wordpress CMS.
Posts: 27300
There is lots of rotation JS scripts out there for adverts. Just plug one into a block and you should be good to go.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 24
I think the checkboxes sound good...
Posts: 27300
Added some checkboxes to select the type of page the block should be on:
http://gallery.menalto.com/node/93525#comment-331498
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 7
Please tell me, how i can put in to code blok AdSense coode?
Posts: 27300
paste your code in the /modules/code_block/views/code_block#.html.php file
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 2
Bug: As of 3.0 Beta 3, every time you click save in admin, it double escapes all special characters. The first time you save, a ' becomes \' , the second becomes \\\' , the third becomes \\\\\\\' ... and so on and so forth.
Posts: 27300
Can you give an example?
Try the lateest version of G3. It was not tested against B3.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 27300
Updated the module to remove data from the var table on deactivation.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 18
Ok, I updated to latest version of Gallery3 and got the ads to work by downloading, installing, activating and finally editing the (views files) and http://www.nigerianfolks.com/gallery is now at it,s uptimum as i would want it.
Way to go folks.
I promise to donate to this course in the nearest future.
Pretenders are people who lack self confidence...
Posts: 79
The multiple code blocks works OK.
However, gallery pages have several <div id="g-metadata" class="g-block">
and don't validate by validator.w3.org
-=SM=-
Posts: 27300
Ser Moro,
I fixed the ids in the above zip file:
http://gallery.menalto.com/node/93525#comment-331498
Thanks for the catch.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 79
Thank you, Dave. Now - perfect.
-=SM=-
Posts: 3
Tried it on RC1, error is there, solved it for myself by putting everything in the code_block.html.php file
you can see it here, code block is called test 2
Posts: 69
floridave,
To me the instructions were confusing. With the code block, you would normally add the code into the UI. However, for php/jsp, you're saying that that code should be added directly into the files. That's not how I understood it. I thought there was some kind of setting in the files that would allow you to enter php/jsp into the UI. So it was confusing. Just "edit the file" is not enough, it would be great if it said 'edit the file to add the desired php/jsp directly into the code block" or something like that.
Anisa.
Posts: 27300
Fixed in the docs:
http://codex.gallery2.org/Gallery3:Modules:code_block#Advanced_usage
Feel free to edit as you see fit. Did you want me to fix the text in the UI as well?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 394
One of the most useful modules out there. A must have.
Posts: 394
Is it possible to allow
.sidebar a:hover {color: #FF9933;
}
in the sidebar for code block using "class"?
Posts: 27300
Please explain with a URL.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 394
OK on the left side you will see your Code Block. Below the heading NAVIGATION you will see three links. I want those to hover if possible:
http://www.dwdallam.com/G3_DWDALLAM/
Posts: 27300
.g-block-content a:hover {color:#0000FF!important;}
Adjust the color as you need.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 394
Perfect, thanks.
Posts: 27300
Comments are now permitted for this topic.
Posts: 2
I'm probably just overlooking something but I want to add some html code for widgets in a couple blocks to display in the sidebar and header. Is there a way to create ad-hoc blocks to do this?