MyBB Community Forums

Full Version: Custom website image.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

First of all, I'm not even sure if I'm of the right section, if I'm not please move it to the right one.

To the point, I wanted to make a custom website image which links to the users' website instead of the default website link (['button_www']), which I did. The problem is that if the user hasn't submit his website link the image is still there with a link pointing to the forum topic.

My question is: Can I code this someway that when there's no submitted website the image will disappear and opposite, when there's a website submitted the image will appear?

edit: I also tried this one but it didn't work. {$post['<img src="myimage.png"></img>']}

Thanks in advance.
Anyone?
This:
{$post['<img src="myimage.png"></img>']}
is something that would never work. Not sure what you meant by that.

Why don't you simply edit the postbit_www template and add your <img /> there? No reason to change postbit/postbit_classic.
Well, I don't know. It confused me a lot.

Anyway, thanks for the answer, appriciate it.

(2015-04-28, 04:04 PM)Destroy666 Wrote: [ -> ]This:



{$post['<img src="myimage.png"></img>']}
is something that would never work. Not sure what you meant by that.

Why don't you simply edit the postbit_www template and add your <img /> there? No reason to change postbit/postbit_classic.

Well, let me clear this as much as I can.

I want to add a second website option, for soundcloud. I made custom profile field where you add your soundcloud id (e.g. www.soundcloud.com/-->soundcloudid<--).

Now the actual problem is that I want this custom profile field to be displayed in the postbit as an image.


Example:

In the postbit template, for the website I use this:

<a href="{$post['website']}" target="_blank">{$post['button_www']}</a>

If I'm correct the button_www is a tag for the postbit template.

So, I made a postbit template called, postbit_soundcloud where I used the code from postbit_www.

<a href="https://soundcloud.com/{$post['fid4']}" target="_blank" title="{$lang->postbit_soundcloud}" class="postbit_soundcloud"><span><img src="images/icons/soundcloud.png"></img></span></a>


So my actual question is, can I make a tag, like button_www for my soundcloud template and use it like this?


<a href="https://soundcloud.com/{$post['fid4']}" target="_blank">{$post['button_soundcloud']}</a>



I hope this explains it. Undecided
Well, you should have mentioned we're talking about a profile field here at the beginning. Anyways:

(2015-04-28, 06:14 PM)adsol93 Wrote: [ -> ]So my actual question is, can I make a tag, like button_www for my soundcloud template and use it like this?

It's not a tag, it's a PHP variable.

You can:
1. Download and activate Template Conditionals: http://mybbhacks.zingaburga.com/showthre...464&page=6
2. Assuming you created the postbit_soundcloud template as you said above, add this code to the postbit_author_user or a similar template:
<if $post['fid4'] then>
<template postbit_soundcloud>
</if>
Thank you for your help, it works just great!

I apologize for the mess. Shy