phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

How do I replace any {IMG} with Font Awesome icons ?


 
Search this topic... | Search MOD Writing... | Search Box
Register or Login to Post    Index » MOD Writing  Previous TopicPrint TopicNext Topic
Author Message
EmeraldDragon
Board Member



Joined: 19 Mar 2021

Posts: 5


flag
PostPosted: 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


flag
PostPosted: 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


flag
PostPosted: 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: 228



PostPosted: 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


flag
PostPosted: 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


flag
PostPosted: 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


flag
PostPosted: 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


flag
PostPosted: 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. icon_sad.gif I guess I won't be doing it then.
Back to top
Display posts from previous:   
Register or Login to Post    Index » MOD Writing  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0251 seconds using 16 queries. (SQL 0.0020 Parse 0.0008 Other 0.0222)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo