Custom Attribute that will display as hyperlink
Permalink 1 user found helpful
I need to add an attribute that when the users enters a url will on output to the page will be a hyperlink.
Is there a Custom Attribute type out there that would do this?
Thank you
Is there a Custom Attribute type out there that would do this?
Thank you
You can do this with a text attribute. In a theme you can reference the attribute and spit out a hyperlink.
cool!
What would i do if i wanted to make the url appear as a button.
wrap it in a div and do image replacement?
<div class="bidbutton">
<?php
$myURL = $c->getAttribute('bid_url');
echo '<a href="' . $myURL . '">' . $myURL . '</a>'; ?>
</div
.bidbutton {
padding-top: 35px;
height: 0px;
overflow: hidden;
background-image: url(../images/bidbutton.gif);
background-repeat: no-repeat;
}
What would i do if i wanted to make the url appear as a button.
wrap it in a div and do image replacement?
<div class="bidbutton">
<?php
$myURL = $c->getAttribute('bid_url');
echo '<a href="' . $myURL . '">' . $myURL . '</a>'; ?>
</div
.bidbutton {
padding-top: 35px;
height: 0px;
overflow: hidden;
background-image: url(../images/bidbutton.gif);
background-repeat: no-repeat;
}
Something like that would work - you could also just give the anchor tag a class.
Keep in mind that this will produce a link like:
<a href="http://google.com">http://google.com</a>
If you actually wanted words as a hyperlink you'll need to go a different route - either abandon the attribute idea and go with a block, add another attribute 'url-text' or something or use a non URL character to break the attribute into two portions and use PHP to split them.
Something like
You could read that in PHP, find the (|) and create two variables, load the one as the href and the other in between the <a></a> tags.
Keep the users of the system in mind - do whatever is going to be easiest for them to remember.
Keep in mind that this will produce a link like:
<a href="http://google.com">http://google.com</a>
If you actually wanted words as a hyperlink you'll need to go a different route - either abandon the attribute idea and go with a block, add another attribute 'url-text' or something or use a non URL character to break the attribute into two portions and use PHP to split them.
Something like
My Link Text|http://google.com
You could read that in PHP, find the (|) and create two variables, load the one as the href and the other in between the <a></a> tags.
Keep the users of the system in mind - do whatever is going to be easiest for them to remember.
Maybe you can help with my issue.
http://www.concrete5.org/community/forums/usage/create-user-attribu...
I can get the link to appear but it is not doing anything with the php. I want to link this code from the original members page:
Do I need to pull more code from the members page and will it only work with html and not php?
http://www.concrete5.org/community/forums/usage/create-user-attribu...
I can get the link to appear but it is not doing anything with the php. I want to link this code from the original members page:
Do I need to pull more code from the members page and will it only work with html and not php?
Maybe you can help with my issue.
http://www.concrete5.org/community/forums/usage/create-user-attribu...
I can get the link to appear but it is not doing anything with the php. I want to link this code from the original members page:
Do I need to pull more code from the members page and will it only work with html and not php?
http://www.concrete5.org/community/forums/usage/create-user-attribu...
I can get the link to appear but it is not doing anything with the php. I want to link this code from the original members page:
Do I need to pull more code from the members page and will it only work with html and not php?
If there is no value for the link attribute you can use this that will only display the link space if it's filled in. That way you don't get any unnecessary spaces in your public view:
<? $someLinkableAttribute = $profile->getAttribute('some_linkable_attribute'); ?> <? if($someLinkableAttribute!=NULL){ echo '<a href="'.$someLinkableAttribute.'">Link Text</a>' ; } ?>