Link Styling

Permalink Browser Info Environment
Is it possible to specify a CSS class the link? I am using the Framework theme and it has a number of button classes that can be applied to text in content blocks. It ends up in html as "<p class=...">text</p>. If only I could do something similar with your block it would be perfect for what I need.

So if it's not possible to specify the class using your block is there an alternative where I could hardcode something in an HTML block?

Thanks
Rick

Type: Pre-Sale
Status: In Progress
View Replies:
jordif replied on at Permalink Reply
jordif
Hi!

You could try this:

1. Edit the block and select "SPAN" as the formatting style. Then save the block.

2. Click on the block and choose "Design & Custom template". Click on the "Gear icon" and enter the classes in the "Custom class" box. For instance, try entering the following classes: btn btn-default


Hope this helps

Jordi
RickJ replied on at Permalink Reply
Hi Jordif,

Yes I tried that and it created a button spanning the width of the block. What I wanted was a button sized to the width of the text centered in the area where I placed the block. I was able to hack the view.php file as I explain below. It's working now to my satisfaction but I am curious about what is the proper C5 way of implementing my solution. This could be an opportunity to learn more about C5 development.
jordif replied on at Permalink Reply
jordif
Hi,

glad you got it working!

The recommended way would be to copy the hacked view.php file under the following path:

/application/blocks/login_logout_link/


If you edit the original files, the changes will be lost if you ever update the add-on. So the proper way is to override the file by placing a copy under /application.

More info:

http://documentation.concrete5.org/tutorials/override-almost-any-co...


Jordi
RickJ replied on at Permalink Reply
Ok, I successfully hacked the view.php file to get it working the way I want. There were two problems applying the btn, btn-primary classes to the block. The first problem was that the button covered the full width of the block. After that was solved there was a problem centering the button, because the length of text is not known until after the php function returns. The solution was to specify a div width of 125px that corresponds to the width of the button text.

<?php  defined('C5_EXECUTE') or die("Access Denied."); ?>
<div style="margin: 0px auto; width: 125px;">
   <a href="<?php  echo $url;?>"><span class="btn btn-primary"><?php echo $label?></span></a> 
</div>

concrete5 Environment Information

V5.7

Browser User-Agent String

Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

Click below to request a refund for License #7962300. Assigned to Mitek Automation.
Created on Sep 07 2016 at 8:54 pm
.