Author |
Message |
EmeraldDragon Board Member

Joined: 19 Mar 2021
Posts: 5

|
Posted: Fri Mar 19, 2021 9:05 pm Post subject: How do I replace any {IMG} with Font Awesome icons ? |
|
|
I am current trying to replace all images files with Font Awesome Icons. For example, right now if I replaced {postrow.REPORT_IMG} with the <i class="fas fa-reply fa__image_icons">NEED TO DISPLAY LINK WHEN HOVER OVER THE ICON</i> in place of the. I would get the Font Awesome Icon without the link. I need to produced the link inside the Font Awesome icon, but I could not figure out what I need to use to put to create the link.
Can someone assist me with this? |
|
Back to top |
|
 |
Salvatos Board Member

Joined: 19 Feb 2009
            Posts: 446 Location: Québec

|
Posted: Sat Mar 20, 2021 6:14 am Post subject: Re: How do I replace any {IMG} with Font Awesome icons ? |
|
|
The link markup is part of the {postrow.REPORT_IMG} variable, so instead of editing the template file, you should edit the viewtopic.php file where that variable is generated.
I don’t have that variable in my vanilla code base, so here is an example with {postrow.EDIT_IMG} at line 1000:
Code: | REPLACE
$edit_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_edit'] . '" alt="' . $lang['Edit_delete_post'] . '" title="' . $lang['Edit_delete_post'] . '" border="0" /></a>';
WITH
$edit_img = '<a href="' . $temp_url . '" title="' . $lang['Edit_delete_post'] . '"><i class="fas fa-reply fa__image_icons"></i></a>'; |
As you can see, I replace the IMG tag with the FontAwesome code, and move the title attribute to the A tag so the tooltip still shows on hover (alt is no longer necessary). |
|
Back to top |
|
 |
EmeraldDragon Board Member

Joined: 19 Mar 2021
Posts: 5

|
Posted: Sun Mar 21, 2021 12:08 am Post subject: Re: How do I replace any {IMG} with Font Awesome icons ? |
|
|
So, there is no way other than editing the code base? Just wondering. |
|
Back to top |
|
 |
Vendethiel Board Member

Joined: 26 Oct 2014
      Posts: 224

|
Posted: Sun Mar 21, 2021 1:06 am Post subject: Re: How do I replace any {IMG} with Font Awesome icons ? |
|
|
You'll have to edit at least the templates; probably the code as well _________________ Developer on EzArena, the ADR premod.
Developer on Icy Phoenix, the phpBB hybrid cms.
Developer on IntegraMOD, the full-featured premod.
Help me archive premods on github! (fixed for recent PHPs). |
|
Back to top |
|
 |
Salvatos Board Member

Joined: 19 Feb 2009
            Posts: 446 Location: Québec

|
Posted: Sun Mar 21, 2021 1:47 am Post subject: Re: How do I replace any {IMG} with Font Awesome icons ? |
|
|
EmeraldDragon wrote: | So, there is no way other than editing the code base? Just wondering. |
If you wanted to link to a static page, you could replace the variable entirely with the anchor tag containing the FA tag in the template, but for things like Edit, Report, etc. you need the PHP code to generate the correct URLs and query strings for the relevant topic/user/post/etc., and you can’t put that code in a template file. |
|
Back to top |
|
 |
EmeraldDragon Board Member

Joined: 19 Mar 2021
Posts: 5

|
Posted: Tue Mar 23, 2021 5:43 pm Post subject: Re: How do I replace any {IMG} with Font Awesome icons ? |
|
|
@ Salvatos, I see. That is my goal of what I want to do, replacing the link to the static page with FA tag in the template. So it will display FA tag instead of the image.
@ Vendethiel, if possible, I would like to just edit the template and not the code. |
|
Back to top |
|
 |
Salvatos Board Member

Joined: 19 Feb 2009
            Posts: 446 Location: Québec

|
Posted: Tue Mar 23, 2021 8:31 pm Post subject: Re: How do I replace any {IMG} with Font Awesome icons ? |
|
|
I mean, you could do something like this, but it would break the functionality of most, if not all, of those links.
Code: | <a href="http://www.phpbb2refugees.com/posting.php" title="Hardcoded title text"><i class="fas fa-reply fa__image_icons"></i></a> |
Without PHP to specify IDs and the like, those pages won’t load anything from the DB and just show an error message. That’s why you can’t just change the template for links to forum pages. |
|
Back to top |
|
 |
EmeraldDragon Board Member

Joined: 19 Mar 2021
Posts: 5

|
Posted: Thu Mar 25, 2021 3:16 pm Post subject: Re: How do I replace any {IMG} with Font Awesome icons ? |
|
|
Salvatos wrote: | I mean, you could do something like this, but it would break the functionality of most, if not all, of those links.
Code: | <a href="http://www.phpbb2refugees.com/posting.php" title="Hardcoded title text"><i class="fas fa-reply fa__image_icons"></i></a> |
Without PHP to specify IDs and the like, those pages won’t load anything from the DB and just show an error message. That’s why you can’t just change the template for links to forum pages. |
I see what you meant. I guess I won't be doing it then. |
|
Back to top |
|
 |
|