DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • September 25, 2017, 01:35:39 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: New Template Issues  (Read 967 times)
0 Members and 1 Guest are viewing this topic.
aeanos
Militia
**
Offline Offline

Posts: 67



View Profile
« on: February 23, 2017, 04:53:38 PM »

Hello all,

I haven't posted here in years, but I've recently started working with version 1.1.1 of the system again. As such, I've been building a new, more modern template, using XHTML, and everything works great except for one nagging issue. Namely, all of the content areas, like the login section, village descriptions, and comment section, are being passed onto the page without getting placed into the content section. I've gone over all of the hooks that should be in the template, and none of them seem to be pulling from where the content actually is (for instance, there is no village* or race* hook pulling the descriptions). I've gone through everything I can think of, like pageparts, commentary, source, etc., etc., but can't seem to figure out how the info is being served. I've also tried moving the commented sections, like the login area, into the main page code, but it breaks the template, if you do.

So, can anyone tell me how to contain the text (descriptions/commentary) properly, and get it to where it needs to go? Also, can anyone think of a way to make it work so that I don't need to have two sets of header info? I've tried to get it to work off of the usual single header, but the system seems to require two full sets.

Thank you in advance.

Here's a screenshot, showing what the problem looks like:


And, here's the template I've created, so far: (Edited to match current version, with no change in the issues faced.)
Code:
<!--!popuphead-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<!--
Copyright: Me
License: All Rights Reserved>
-->
<!-- Meta Data -->
<title>{title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="cache-control" content="public" />
<meta name="language" content="en" />
<link rel="stylesheet" type="text/css" href="templates/v2.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" />
<link rel="icon" type="image/png" href="images/logindragon.gif" />
{headscript}{script}
</head>
<body dir="ltr" lang="en-US" ontouchstart="" xml:lang="en-US">
<div class="sidenav center small hide-small card-2">
<ul style="list-style-type: none;">
<li><span class='pagetitle'>{title}</span></li>
<li>{copyright} Designed by Me</li>
</ul>
</body>
</html>
<!--!header-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>{title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="cache-control" content="public" />
<meta name="language" content="en" />
<link rel="stylesheet" type="text/css" href="templates/v2.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" />
<link rel="icon" type="image/png" href="images/logindragon.gif" />
{headscript}{script}
</head>
<body dir="ltr" lang="en-US" ontouchstart="" xml:lang="en-US">

<div class="sidenav center card-2">
<ul style="list-style-type: none;margin-left:-40px;">
<li><strong>{title}</strong></li>
<li>{nav}</li>
<li><div class="amber card-2">{stats}</div></li>
<li>{navad}</li>
<li>{motd}</li>
<li>{mail}</li>
<li>{petition}</li>
<li>{paypal}</li>
<li>{verticalad}</li>
<li><div class="amber card-2" style="margin-left:-40px;">{petitiondisplay}</div></li>
</ul>
</div>

<div class="padding-large">

  <!-- Header -->
<div class="container padding-24 center">
<h1 class="jumbo">{headerad}</h1>
<h2>{title}</h2>
<p>THIS IS WHERE THE HEADER ENDS</p>
</div>

  <!-- Content -->
<div class="content justify padding-64">
{content}
{bodyad}
{source}
{version}
<p>THIS IS WHERE THE CONTENT ENDS</p>
</div>

<div class="footer justify">
<ul style="list-style-type: none;">
<li>{copyright} Designed by Me ({pagegen})</li>
<li>THIS IS WHERE THE FOOTER ENDS</li>
</ul>
</div>
</div>
</body>
</html>

<!--!statstart--><div class="center card-2"><ul style="list-style-type:none;margin-left:-40px;">
<!--!stathead--><li><strong>{title}</strong></li>
<!--!statrow--><li><strong>{title}</strong> {value}</li>
<!--!statbuff--><li><strong>{title}</strong> {value}</li>
<!--!statend--></ul></div>
<!--!navhead--><div class="amber center card-2"><strong>{title}</strong></div>
<!--!navhelp--><strong>{text}</strong>
<!--!navitem--><a href="{link}"{accesskey}class="nav" {popup}>{text}</a>
<!--!petitioncount--><ul style="list-style-type: none;"><li>{petitioncount}</li></ul>
<!--!login-->
<div class="content justify padding-64">
<ul style="list-style-type: none;">
<li><img src="images/logindragon.gif" class="noborder"></li>
<li>{username}:<br /><input name='name' id="name" accesskey="u" size="10"></li>
<li>{password}:<br /><input name="password" id="password" accesskey="p" type="password" size="10"></li>
<li><input type="submit" value="{button}" class="button"></li>
</ul>
</div>
<!--!loginfull-->
<div class="content justify padding-64">
<ul style="list-style-type: none;">
<li><img src="images/logindragon.gif" class="noborder"></li>
<li>Server Full!</li>
</ul>
</div>


« Last Edit: February 24, 2017, 12:27:28 AM by aeanos » Logged
aeanos
Militia
**
Offline Offline

Posts: 67



View Profile
« Reply #1 on: February 24, 2017, 12:03:33 AM »

Just to add to the explanation, here, in the example shown, I know that the following areas have something to do with it.

The village description comes from a races module that appears to use this hook:
Code:
case "villagetext":

Following that to the village.php, we find:
Code:
$texts = modulehook("villagetext",$origtexts);
//and now a special hook for the village
$texts = modulehook("villagetext-{$session['user']['location']}",$texts);
$schemas = $texts['schemas'];

tlschema($schemas['title']);
page_header($texts['title']);
tlschema();

addcommentary();
$skipvillagedesc = handle_event("village");
checkday();

It also shows the following, at the end:
Code:
if (!$skipvillagedesc) {
modulehook("collapse{", array("name"=>"villagedesc-".$session['user']['location']));
tlschema($schemas['text']);
output($texts['text']);
tlschema();
modulehook("}collapse");
modulehook("collapse{", array("name"=>"villageclock-".$session['user']['location']));
tlschema($schemas['clock']);
output($texts['clock'],getgametime());
tlschema();
modulehook("}collapse");
modulehook("village-desc",$texts);
//support for a special village-only hook
modulehook("village-desc-{$session['user']['location']}",$texts);
if ($texts['newestplayer'] > "" && $texts['newest']) {
modulehook("collapse{", array("name"=>"villagenewest-".$session['user']['location']));
tlschema($schemas['newest']);
output($texts['newest'], $texts['newestplayer']);
tlschema();
$id = $texts['newestid'];
if ($session['user']['superuser'] & SU_EDIT_USERS && $id) {
$edit = translate_inline("Edit");
rawoutput(" [<a href='user.php?op=edit&userid=$id'>$edit</a>]");
addnav("","user.php?op=edit&userid=$id");
}
output_notl("`n");
modulehook("}collapse");
}
}
modulehook("village",$texts);
//special hook for all villages... saves queries...
modulehook("village-{$session['user']['location']}",$texts);

if ($skipvillagedesc) output("`n");

$args = modulehook("blockcommentarea", array("section"=>$texts['section']));
if (!isset($args['block']) || $args['block'] != 'yes') {
tlschema($schemas['talk']);
output($texts['talk']);
tlschema();
commentdisplay("",$texts['section'],"Speak",25,$texts['sayline'], $schemas['sayline']);
}

module_display_events("village", "village.php");
page_footer();
?>

I also know that "village" and "villagehook" show up in cities.php, but they seem to only be there in order to add new instances to the navigation options. Commentary.php also seems to be useless, aside from passing along the name of the village. And, home.php seems to be of no use, aside from using "villagename" in conjunction with telling what time it is.
« Last Edit: February 24, 2017, 12:05:16 AM by aeanos » Logged
Eliwood
Member
Codemeister
****
Offline Offline

Posts: 270


View Profile WWW
« Reply #2 on: February 24, 2017, 12:41:44 AM »

As such, I've been building a new, more modern template, using XHTML, and everything works great except for one nagging issue.

XHTML isn't modern, it's just HTML defined via XML instead of SGML. I recommend to not use XHTML since it is far more strict and you don't have the control over all the HTML part, except if you re-write all modules you use yourself. Besides, XHTML has been abandoned by the W3. Instead, use HTML5.

Quote
Namely, all of the content areas, like the login section, village descriptions, and comment section, are being passed onto the page without getting placed into the content section. I've gone over all of the hooks that should be in the template, and none of them seem to be pulling from where the content actually is (for instance, there is no village* or race* hook pulling the descriptions). I've gone through everything I can think of, like pageparts, commentary, source, etc., etc., but can't seem to figure out how the info is being served. I've also tried moving the commented sections, like the login area, into the main page code, but it breaks the template, if you do.

You write to put the content using a {content}-Tag. Did you actually find this tag in any of the supplied templates? A good starting point is http://dragonprime.net/index.php?page=skins#template.

In short, each template (and both the popup and the normal part) consists of 2 template-parts - the header and the footer, depicted by <!--!header--> (<!--popuphead-->) and <!--footer--> (<!--popupfoot-->). The template engine reads the template file and breaks it at every <!--!, then reads the stuff between ! and --> and puts it in an array. Then, the engine starts to put the stuff together again.

It is important to note that there is no {content} in this template-engine. Everything that gets written to output (with output(), rawoutput(), whatever else) put between the header-part and the footer-part.

Code:
<!--header-->
<!DOCTYPE html>
<html>
<body>
<!--!footer-->
</body>
</html>

After fragmentation and putting the template together, lotgd simply prints something along the lines of
Code:
print($header . $output . $footer)
. The file you look for is (if I recommend it correctly) is lib/pageparts.php.
Logged

Daenerys LotGD-Remake using PHP7 and a modern, headless approach.
aeanos
Militia
**
Offline Offline

Posts: 67



View Profile
« Reply #3 on: February 24, 2017, 02:45:38 AM »

I included the {content} tag in the <div class="content"> section, however, it still shows up at the end of everything, after the footer. That's why I was thinking there was something else I had missed.

As for the whole HTML5 thing, though, thank you for pointing that out. (Seriously.) I had no idea it had been recommended since 2014, until I looked it up, just now. I stopped being a developer in 2009, and I was using this project to dust off my coding skills, before trying to work as a developer, again. So, it looks like I have to learn a language, now. lol
Logged
Eliwood
Member
Codemeister
****
Offline Offline

Posts: 270


View Profile WWW
« Reply #4 on: February 24, 2017, 04:00:17 AM »

I included the {content} tag in the <div class="content"> section, however, it still shows up at the end of everything, after the footer. That's why I was thinking there was something else I had missed.

Maybe I was a bit unclear in my post. There is no {content} tag. All content gets placed after the header part, and before the footer part. No template that I know of has this content tag.

Quote
As for the whole HTML5 thing, though, thank you for pointing that out. (Seriously.) I had no idea it had been recommended since 2014, until I looked it up, just now. I stopped being a developer in 2009, and I was using this project to dust off my coding skills, before trying to work as a developer, again. So, it looks like I have to learn a language, now. lol

You're welcome. It's always hard to come back when technology advances so fast - luckily for you, lotgd didn't advance at all ... Wink which we are going to change.
Logged

Daenerys LotGD-Remake using PHP7 and a modern, headless approach.
aeanos
Militia
**
Offline Offline

Posts: 67



View Profile
« Reply #5 on: February 24, 2017, 10:24:44 AM »

Ahhh... Yes, I found the {content} tag in all of the templates for 1.1.1. It shows up at the end of the page, though, between {petitioncount} and {username}, which doesn't make much sense. That's why I tried putting it where I wanted it to go.

yarbrough:
{title}
{text}
{text}
{petitioncount}
{content}
{username}:    {password}:

classic:
{title} {text}
{text}
{petitioncount}
{content}
{username}:    {password}:
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Version 1.1.2 is the current supported version and is available for download.

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
27 Guests, 2 Users
pelantas, Robert M
Home Forums News Downloads Login Register Advanced Search