which is the proper way to use variables

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
chief_wolfinjo
Registered User
Posts: 77
Joined: Thu Sep 22, 2016 3:05 pm

which is the proper way to use variables

Post by chief_wolfinjo »

Hello :)

I hope you can tell me which way is correct way for phpBB ?

this:

Code: Select all

<!-- IF SOME_FUNCTION == 'Yes' -->
		<div id="sidebar">
		<!-- IF HTML_SIDEBAR -->
		<div class="sidebar-block">
		{HTML_SIDEBAR}
		</div>
		<!-- ENDIF -->
or

Code: Select all

<!-- IF SOME_FUNCTION == 'Yes' -->
		<div id="sidebar">
		<div class="sidebar-block">
		{HTML_SIDEBAR}
		</div>
		<!-- ENDIF -->
and second question about this, how to properly do this ?

Code: Select all

		<!-- IF SOME_OTHER_FUNCTION == 'Yes' -->
		<div class="some-container">
		<div class="some-container-widget">
		<div class="some-container-icons">	
		<span class="some-container-front">
		{SOCIAL_WIDGET_TITLE}		
		</span>
		<div class="some-container-icons-behind">
		<a class="some1" title="{WIDGET_FIRST_TITLE}" href="{WIDGET_FIRST_URL}" target="_blank">
		<i class="{WIDGET_FIRST_AWESOME}" aria-hidden="true"></i>
		</a>	
		</div>
			</div>
			</div>
			</div>
			<!-- ENDIF -->
Last edited by chief_wolfinjo on Fri Aug 03, 2018 12:37 pm, edited 2 times in total.
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: which is the proper way to use variables

Post by david63 »

Both are right depending on circumstances - although the first one does need another <!-- ENDIF -->
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
User avatar
chief_wolfinjo
Registered User
Posts: 77
Joined: Thu Sep 22, 2016 3:05 pm

Re: which is the proper way to use variables

Post by chief_wolfinjo »

david63 wrote: Fri Aug 03, 2018 10:58 am Both are right depending on circumstances - although the first one does need another <!-- ENDIF -->
ok. so both are ok, but first with another if statement is maybe better ?

and can you tell me about second question ?

do I need to add if statements ?

Thank you
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: which is the proper way to use variables

Post by david63 »

chief_wolfinjo wrote: Fri Aug 03, 2018 11:04 am but first with another if statement is maybe better ?
Only you know that as I have no idea what it is that you are trying to do.
chief_wolfinjo wrote: Fri Aug 03, 2018 11:04 am and can you tell me about second question ?
That was not there when I posted my reply
chief_wolfinjo wrote: Fri Aug 03, 2018 11:04 am do I need to add if statements ?
No idea as I do not have a clue as to what it is that you are trying to do - but if you want to add some more IF statements then go ahead if it will improve your code.
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
User avatar
chief_wolfinjo
Registered User
Posts: 77
Joined: Thu Sep 22, 2016 3:05 pm

Re: which is the proper way to use variables

Post by chief_wolfinjo »

david63 wrote: Fri Aug 03, 2018 11:21 am
chief_wolfinjo wrote: Fri Aug 03, 2018 11:04 am but first with another if statement is maybe better ?
Only you know that as I have no idea what it is that you are trying to do.
but both ways are correct in terms of phpbb ?

and about second question:

is this correct:

Code: Select all

		<!-- IF SOME_OTHER_FUNCTION == 'Yes' -->
		<div class="some-container">
		<div class="some-container-widget">
		<div class="some-container-icons">	
		<span class="some-container-front">
		{SOCIAL_WIDGET_TITLE}	
		</span>
		<div class="some-container-icons-behind">
		<a class="some1" title="{WIDGET_FIRST_TITLE}" href="{WIDGET_FIRST_URL}" target="_blank">
		<i class="{WIDGET_FIRST_AWESOME}" aria-hidden="true"></i>
		</a>	
		</div>
			</div>
			</div>
			</div>
			<!-- ENDIF -->
or this:

Code: Select all

		<!-- IF SOME_OTHER_FUNCTION == 'Yes' -->
		<div class="some-container">
		<div class="some-container-widget">
		<div class="some-container-icons">	
		<span class="some-container-front">
                <!-- IF SOCIAL_WIDGET_TITLE -->
		{SOCIAL_WIDGET_TITLE}		
		</span>
                <!-- ENDIF -->
		<div class="some-container-icons-behind">
               <!-- IF WIDGET_FIRST_TITLE && IF WIDGET_FIRST_URL -->
		<a class="some1" title="{WIDGET_FIRST_TITLE}" href="{WIDGET_FIRST_URL}" target="_blank">
                 <!-- ENDIF -->
                 <!-- IF WIDGET_FIRST_AWESOME -->
		<i class="{WIDGET_FIRST_AWESOME}" aria-hidden="true"></i>
                <!-- ENDIF -->
		</a>	
		</div>
			</div>
			</div>
			</div>
			<!-- ENDIF -->
Thank you
Post Reply

Return to “Extension Writers Discussion”