Adding a simple line of text

For support and discussion related to templates, themes, and imagesets in phpBB 3.2.
DV1
Registered User
Posts: 399
Joined: Sun Jul 11, 2010 8:49 pm
Location: Nevada

Adding a simple line of text

Post by DV1 »

Looking at the "mechanisms" of the phpBB board and the inclusion thereof of elements - in this case a simple line of text - I'm reminded of that humorous phrase, "You can't get there from here". But upon closer examination the phrase is more accurately, "You can get there from here, but not in a straight line".

Example: On the Prosilver template I'd like a way of putting some text on the index page. The text could be a notification, a comment, or whatever other information one chooses. It could be under the forums (or a particular forum), it could be in the area where 'who is online' or 'birthdays' is at, footer area, etc.

I know there is an ads extension that achieves that in a way but I'm wondering if there is a simple, template snippet that could be added as a div wherever chosen. I know that in the templates I can add a different image or link so I'm thinking if there could be a template snippet with a space where it says "add text here" or some such.

I hope I explained that right in trying to 'get there from here'. :)

Thanks

Daniel
User avatar
Lumpy Burgertushie
Registered User
Posts: 69228
Joined: Mon May 02, 2005 3:11 am

Re: Adding a simple line of text

Post by Lumpy Burgertushie »

very simple;
open the relevant html file in the styles/yourstyle/template folder.

if you want it to show on all pages that would be the overall_header.html file for the top of the page and/or the overall_footer.html file for the bottom of the pages.

if you want it only on the index page put it at the top or the bottom of index_body.html
if the viewforum page, that would be viewforum_body.html, and lastly, if viewtopic...yep, you guessed it, viewtopic_body.html.


on any other pages they are usually named such that you can figure out which file to edit.

keep in mind that if you edit the prosilver files, you will have to redo those edits each time you update/upgrade phpbb versions.


robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
DV1
Registered User
Posts: 399
Joined: Sun Jul 11, 2010 8:49 pm
Location: Nevada

Re: Adding a simple line of text

Post by DV1 »

Thank you, Robert.

Now, you probably already know from some of my postings that when it comes to plain html that's no problem. But when it's a phpBB html template, that's a different story. :shock: :)

Could you show, or refer me to, an example of what that template code would be for the text as described?

Daniel
User avatar
Lumpy Burgertushie
Registered User
Posts: 69228
Joined: Mon May 02, 2005 3:11 am

Re: Adding a simple line of text

Post by Lumpy Burgertushie »

for example, open overall_header.html in a good text editor. ( not any kind of wysiwyg html editor )
find: <body id="phpbb" class="nojs notouch section-{SCRIPT_NAME} {S_CONTENT_DIRECTION} {BODY_CLASS}">
after it, on a new line, type this: Hello World!
save the file, upload it to your server.
go to your admin panel, purge the cache.
refresh your browser.

you should see Hello World!" at the very top of the page.

it is just that simple.

if you want to be able to change the text often, then you can create a new html file, name it header_text.html ( or whatever you want )

in that file, put your Hello World! text.
save it. upload it to the template folder.
now, in overall_header.html, wherever you want that text to show up, put this:
<!-- INLCUDE header_text.html -->
upload, purge the cache, refresh template.

now, whenever you want to change the text, you only have to edit the file named header_text.html

you can put whatever html you want in that file and it will show up wherever you put that include line.


robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
DV1
Registered User
Posts: 399
Joined: Sun Jul 11, 2010 8:49 pm
Location: Nevada

Re: Adding a simple line of text

Post by DV1 »

First, made an 'addtext.css':

Code: Select all

.addtext{
	font-family: Verdana;
	font-size: 1em;
	color: #000;
	background-color: #FFF;
	border: 2px solid red;
	padding: 10px;
	max-width: 80%;
	width: 100%;
	height: auto;
	margin: 5em auto 0 auto;
}

The following is a screen shot of addtext.html:

Image

Basic, further styling can be done to fit forum.

This is the html:

Code: Select all

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>textbox-test</title>
		<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
			<link type="text/css" rel="stylesheet" href="addtext.css" />
		</head>
		<body>
			<div class="addtext">

        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
        in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


    </div>
		</body>
	</html>
Going by the look of templates, then in the 'add_text.html' template I can dispense with head section, body, etc., thus narrowing it down to:

Code: Select all

<div class="addtext">

        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
        in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


    </div>
If so, how does that translate to 'template-speak'? :)

I want to put it right above 'Who Is Online'. Index, no other page.

Apparently, that would be somewhere in this area in index_body.html:

Code: Select all

<!-- ENDIF -->

<!-- EVENT index_body_stat_blocks_before -->

<!-- IF S_DISPLAY_ONLINE_LIST -->
	<div class="stat-block online-list">
		<!-- IF U_VIEWONLINE --><h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3><!-- ELSE --><h3>{L_WHO_IS_ONLINE}</h3><!-- ENDIF -->
		<p>
			<!-- EVENT index_body_block_online_prepend -->
			{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /> 
			<!-- IF U_VIEWONLINE -->
				<br />{LOGGED_IN_USER_LIST}
				<!-- IF LEGEND --><br />{L_LEGEND}{L_COLON} {LEGEND}<!-- ENDIF -->
			<!-- ENDIF -->
			<!-- EVENT index_body_block_online_append -->
		</p>
	</div>
<!-- ENDIF -->
Thanks
User avatar
Lumpy Burgertushie
Registered User
Posts: 69228
Joined: Mon May 02, 2005 3:11 am

Re: Adding a simple line of text

Post by Lumpy Burgertushie »

there is no template speak for something like this.

have you tried it yet?
yes, you are correct in not needing anything but the actual html for the text. no head section etc.

just make a copy of your index_body.html file and then try it to see what happens.


robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
DV1
Registered User
Posts: 399
Joined: Sun Jul 11, 2010 8:49 pm
Location: Nevada

Re: Adding a simple line of text

Post by DV1 »

To colours.css I added the .addtext:

Code: Select all

.addtext{
	font-family: Verdana;
	font-size: 1em;
	color: #000;
	background-color: #FFF;
	border: 2px solid red;
	padding: 10px;
	width: 100%;
	height: auto;
	margin: 5em auto 0 auto;
}

Here is the add_text.html:

Code: Select all

			<div class="addtext">

        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
        in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    </div>
I added <!-- INLCUDE add_text.html --> to the following area in index-body:

Code: Select all

<!-- ENDIF -->

<!-- EVENT index_body_stat_blocks_before -->

<!-- INLCUDE add_text.html -->

<!-- IF S_DISPLAY_ONLINE_LIST -->
	<div class="stat-block online-list">
		<!-- IF U_VIEWONLINE --><h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3><!-- ELSE --><h3>{L_WHO_IS_ONLINE}</h3><!-- ENDIF -->
Used good editor, purged, etc.

Nothing. Which of the above is wrong?

Thanks
User avatar
Mannix_
Registered User
Posts: 2029
Joined: Sun Oct 25, 2015 2:56 pm
Name: Matt

Re: Adding a simple line of text

Post by Mannix_ »

Purge your browser cache/visit site in incognito mode of your browser see if your edit is there.
Did I helped You? Consider a donation.
New version of phpBB has been released? My styles aren't validated for it yet? Check my page for the latest downloads!
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53568
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: Adding a simple line of text

Post by Brf »

INLCUDE ?
DV1
Registered User
Posts: 399
Joined: Sun Jul 11, 2010 8:49 pm
Location: Nevada

Re: Adding a simple line of text

Post by DV1 »

@ Brf & Mannix

Well, that wouldn't be the first time when a misplaced letter, omitted period or semicolon made for a vexing experience as to why something wasn't working. :)

Image

As can be seen, it's in the place where I wanted it. Now just a matter of phasing it into the forum style.

The left side is aligned properly but the right side extends more than it should. I guess I can fix the percentage in css, or is that something else having to do with the wrap or body?

Thanks
User avatar
DTMWC
Registered User
Posts: 379
Joined: Tue Jan 16, 2018 6:17 am

Re: Adding a simple line of text

Post by DTMWC »

DV1 wrote: Wed Jul 25, 2018 5:13 pm

Code: Select all

.addtext{
	font-family: Verdana;
	font-size: 1em;
	color: #000;
	background-color: #FFF;
	border: 2px solid red;
	padding: 10px;
	width: 100%;
	height: auto;
	margin: 5em auto 0 auto;
}
If you want it as wide as the wrap you don't need to add the width and the height in the CSS.
Boom.
DV1
Registered User
Posts: 399
Joined: Sun Jul 11, 2010 8:49 pm
Location: Nevada

Re: Adding a simple line of text

Post by DV1 »

Thanks, Stylez.

It's all looking good. :)

I think this one is solved and may help others who would want to add such to their forum. I guess the moderators provide the solved checkmarks.

Thanks to everyone who helped with this.

Daniel

Return to “[3.2.x] Styles Support & Discussion”