Posted by pkcho on January 27, 2010 at 12:12am
I have created a Twitter feed block on my site by pasting the embed code from Twitter into a block. When I put < none > into the block title, it displays a block with no header.
I want a block with a header, but no text. I plan to use my own background image and title via CSS.
I have attached a screenshot of my block header. I basically put the letter "t" in the block title, in the block configuration and colored it white via css so it wouldn't display in the header. I have circled the white texted area in red.
There has to be a more obvious/easier way to do this that I'm missing.
Thank you.
| Attachment | Size |
|---|---|
| Twitter_header.jpg | 5.92 KB |
Comments
What theme are you using?
What theme are you using? Does it look like this
<div class="block block-<?php print $block->module; ?>" id="block-<?php print $block->module; ?>-<?php print $block->delta; ?>"><h2 class="title"><?php print $block->subject; ?></h2>
<div class="content"><?php print $block->content; ?></div>
</div>
I'm using Open Publish
< div id="block-
<?phpprint $block->module .'-'. $block->delta;
?>
<?php
print $block->module ? >" >
< ?php if (!empty($block->subject)): ? >
<h3><?php print $block->subject
?>
<?php endif;? >
<?php print $block->content ? >
(Sorry, I don't know how to make this format correctly)
use the < code > < / code>
use the < code > < / code> for code ( minus the spaces)
replace your template with what i pasted and give it a go. You if statement there excludes the h3 tag if there is no subject...
I see what you pointed out
I see what you pointed out, but I don't understand what you mean by your solution...
"use the < code > < / code> for code ( minus the spaces)
replace your template with what i pasted and give it a go."
I'm sorry. Being a non-coder, I'm a little lost.
No problem. 2 parts to my
No problem. 2 parts to my reply addressing 2 different things :)
1) On these group forum boards ( as well as the issues forum for modules) when you are posting comments and want to display some sort of code you use the < code > </ code> syntax. I added spaces between the brackets and the word "code" so that you are able to see them in this post. The cms automatically takes the content in between the code tag and formats it how you see my php code above. Make sense?
2) Your theme should have a file labeled block.tpl.php. The contents of this file is what I believe you pasted in your reply. Replace the contents of this file with this text below
<div class="block block-<?php print $block->module; ?>" id="block-<?php print $block->module; ?>-<?php print $block->delta; ?>"><h2 class="title"><?php print $block->subject; ?></h2>
<div class="content"><?php print $block->content; ?></div>
</div>
Technical Explanation ( if you are interested)
The reason why I believe your block template wasnt working the way you intended was because in your template you had these lines:
1.< ?php if (!empty($block->subject)): ? >2. <h3><?php print $block->subject ?>
3.<?php endif;? >
Line 1 has an if statement that reads "If the block subject is not empty do the following". $block->subject here is your title
Line 2 prints the block title out ( $block->subject) within < h3 > tags.
Line 3 closes the if statement syntax.
hope that helps
I get it : )
Thank you for taking the time to explain all of this, including the < code > </ code> syntax. You were extremely helpful!