rejetto forum

templates: 80063r's problem

80063r · 19 · 8779

0 Members and 1 Guest are viewing this topic.

Offline 80063r

  • Occasional poster
  • *
    • Posts: 40
    • View Profile
I don't know if this is a build related problem, but it could be.

I have 2 real folders in my tree.  Each has diff.tpl and hfs.diff.tpl (Please clarify which to use, I think its hfs.diff.tpl)  Only one of the folders actually shows the different template applied to it.  The other shows the default template.  I removed and added it again and read the forum (a little) and I've done everything I can think of short of pulling my hair out.  It was initailly working, now its not.  What did I do that broke it (so I won't do it again).

edit:
The point at which it seemed to break is when I double-clicked a file in Windows Explorer and HFS asked if I wanted to install the template.  I chose "No".  After that, it hasn't been working.  Clicking "Yes" doesn't work either.
« Last Edit: May 22, 2009, 06:26:48 PM by 80063r »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
use hfs.diff.tpl
what if you re-add the non-working real folder?


Offline 80063r

  • Occasional poster
  • *
    • Posts: 40
    • View Profile
I tried removing and adding it again.  Same problem.  The page still shows the default template and the other page still shows its hfs.diff.tpl .  One folder works and the other doesn't


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
ok, give me your non-working hfs.diff.tpl
support@rejetto.com if you need to do it privately


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
Quote
The point at which it seemed to break is when I double-clicked a file in Windows Explorer and HFS asked if I wanted to install the template.  I chose "No".  After that, it hasn't been working.  Clicking "Yes" doesn't work either.

Is the hfs.diff.tpl  a template from the RAWR-Designs? , they have the annoying tendency to add their folder ' template ' own in the vfs. if it is the case it is enough to answer yes good time for quite and the problem should disappear ;)
« Last Edit: May 23, 2009, 01:12:31 PM by mars »


Offline 80063r

  • Occasional poster
  • *
    • Posts: 40
    • View Profile
Its just a very simple one to run a test on some functions.

Right now its just:
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<!--{.comment|--><h1 style='margin-bottom:100em'>WARNING: this template is only to be used with HFS 2.3 (and macros enabled)</h1> <!--.} -->
<html>
<head>
</head>
<body>
<div>
{.set|%aa1%|1.}
%aa1%
{.inc|%aa1%|2.}
%aa1%
{.inc|%aa1%.}
%aa1%
</div>
</body>
</html>

I've tried many different templates in this file.  None of them load.  ...well, maybe load, but don't get applied.  I also have a folder which when it matches a url pattern, the macros.log says it loads, but it doesn't get applied.

clip from hfs.tpl:
Code: [Select]
</div>
</body>
</html>
[special:begin]
{.if|{.and|{.or|{.match address|127.0.0.1|%ip%.}|{.match address|192.168.1.1|%ip%.}.}|{.count substring|temporary_test_pages|%url%.}.}|{:{.load|test.tpl.}:}.}

[not found]
<h1>{.!Not found.}</h1>
<a href="/">{.!go to root.}</a>

clip from macros.log:
Code: [Select]
---
> %ip%
< 192.168.1.1

> %ip%
< 192.168.1.1

> %url%
< /temporary_test_pages/inc_test/

> match address|127.0.0.1|192.168.1.1
<

> match address|192.168.1.1|192.168.1.1
< 1

> or||1
< 1

> count substring|temporary_test_pages|/temporary_test_pages/inc_test/
< 1

> and|1|1
< 1

> if|1|{:{.load|test.tpl.}:}
< {.load|test.tpl.}

> load|test.tpl
< <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  </head>
  <body>

  </body>
</html>


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
Quote
[special:begin]
{.if|{.and|{.or|{.match address|127.0.0.1|%ip%.}|{.match address|192.168.1.1|%ip%.}.}|{.count substring|temporary_test_pages|%url%.}.}|{:{.load|test.tpl.}:}.}

I see where is your problem, the command load is not suited here to read a tpl, especially in the section [ special:begin ]

you have to use the macro {.section| sectionname |externalFile.}, but make your call in another section than [special:begin]

hfs.diff.tpl
Quote
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  </head>
  <body>
{.if|{.and|{.match address|127.0.0.1|%ip%.}{.match address|192.168.1.1|%ip%.}|{:{.count substring|temporary_test_pages|%url%.}.}:}|{:{.section|testsection|test.tpl.}:}.}
  </body>
</html>
put it as a diff tpl in a subfolder and see results when you use the follow file

Quote
test.tpl
[testsection]
this section is for test only when your ip is not 129.168.1.1 or 127.0.0.1



Offline 80063r

  • Occasional poster
  • *
    • Posts: 40
    • View Profile
Thank you for that good information.  I removed the [special:begin] section.  I saved a note of your advice.  But the problem still remains that hfs.diff.tpl never gets applied to any new folders that I add.  It only gets applied to the first folder.  All new folders get the default template.

I noticed that other people may have had this same problem, even in previous beta releases.  It seems that reinstalling a fresh copy may solve the problem.  I will try that now and report back later.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
i forgot to remember you that diff tpl are only for virtual folder , and hfs.diff.tpl must be placed into a real folder on hard drive. ;)


Offline 80063r

  • Occasional poster
  • *
    • Posts: 40
    • View Profile
Ok, thank you.  So if I understand you correctly, if you want to apply a different template to a virtual folder, you would use "diff.tpl" and for a real folder you would use "hsf.diff.tpl"  So far, I have only used real folders.

First folder     http://localhost:88/get-ip/
Second folder http://localhost:88/inc_test/

For testing, I copied the hsf.diff.tpl to a second folder to see if it would be applied.  Still, to my surprise, it wasn't.  I tried two fresh copies and in one I added the first folder first, and it worked for the first folder but not the second.  In the second one, I added the second folder first, and it still worked for the first folder but not the second.

« Last Edit: May 23, 2009, 10:22:14 PM by mars »


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
Quote
http://www.techneurosa.com:88/inc_test/

your file has a bad name: not hsf.diff.tpl but hfs.diff.tpl   LOL ;D


Offline 80063r

  • Occasional poster
  • *
    • Posts: 40
    • View Profile
I'll post the contents of hfs.diff.tpl here.  I considered trimming it down some but I didn't want to break it  :-\
Alternatively, you can download it from my second folder!!!

Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<!--{.comment|--><h1 style='margin-bottom:100em'>WARNING: this template is only to be used with HFS 2.3 (and macros enabled)</h1> <!--.} -->
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <link rel="stylesheet" href="/~style.css" type="text/css">
  <link rel="stylesheet" href="/~style.menu.css" type="text/css">
  <title>HFS %folder%</title>
  <link rel="shortcut icon" href="/favicon.ico">

<!--[if lte IE 5.5]>
<style type="text/css">
.menu ul li a, .menu ul li a:visited { width:151px; w\idth:139px; }
</style>
<![endif]-->

{.comment| Thanks to the following line, you can customize the appearance of the original template by right click on the root -> advanced -> diff template
then type [style.user] followed by all the CSS commands you want. This way you will stay up to date while the original template improves.}  
<style type="text/css">{.$style.user.}</style>

<script>
function _(id) { return typeof id == 'string' ? document.getElementById(id) : id; }
</script>

</head>
<body>
<div id='folder'>%ip%</div>
</body>
</html>
<!-- Build-time: %build-time% -->

{.append|get-ip.txt|%ip%
.}
{.add to log|%ip%.}

[style.css|no log]
body, th { font-family:tahoma, verdana, arial, helvetica, sans; font-weight:normal; font-size:9pt; }
body { background-color:#DDF; padding:10px; }
body, p, form { margin:0 }
#folder, .big { font-size:14pt; font-weight:bold;  }

#body {
  border-bottom: 4px solid #BBF;
     border-top: 4px solid #BBF;
    border-left: 1px dotted #BBF;
   border-right: 1px dotted #BBF;
  background:#F3F3FF;
  padding:15px;
  margin:15px;
}
.comment { font-size:7pt; color:#888; background:#EEE; padding:3px; border:1px solid #DDD; margin-top:2px; }
.button { height:24px; padding:4px 10px; margin:5px; border:2px solid black; background:white; font-size:8pt; font-weight:bold; }
a.button { padding:8px 10px; }
a.button img { vertical-align:text-bottom; }
.flag { font-weight:bold; font-size:8pt; background:white; color:red; text-align:center; border:1px solid red; }
.item-folder { font-size:smaller; margin-top:4px; }


[file=folder=link]
  <tr><td>
  {.if|{.get|can delete.}{.and|{.get|can access.}|{.get|can archive item.}.}| <input type='checkbox' name='selection' value="%item-url%"> .}
  {.if|{.get|is new.}|<span class='flag'>&nbsp;NEW&nbsp;</span>.}
  {.if not|{.get|can access.}|<img src='/~img_lock'>.}
  <a href="%item-url%"><img src="%item-icon%"> %item-name%</a>
  {.if| {.?search.} |{:<div class='item-folder'>{.!item folder.} {.breadcrumbs|{:<a href="%bread-url%">%bread-name%/</a>:}|from={.count substring|/|%folder%.}/breadcrumbs.}:} .}
  {.if| %item-comment% | <div class='comment'>%item-comment%</div> .}

[+folder]
<td align='center'><i>folder</i><td align='right'>%item-modified%<td align='right'>%item-dl-count%



Offline 80063r

  • Occasional poster
  • *
    • Posts: 40
    • View Profile
Quote
your file has a bad name: not hsf.diff.tpl but hfs.diff.tpl

I new it had to be something stupid on my part.

Thanks :D

I'll be more careful in the future.
« Last Edit: May 23, 2009, 10:10:44 PM by 80063r »


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
I have redirect the links to your web server, you are new as a template developper,

go to MENU > accept connexions on > check 127.0.0.1

then only you can connect to your server, during you learn how works templates and hfs ;)


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
I see where is your problem, the command load is not suited here to read a tpl, especially in the section [ special:begin ]
you have to use the macro {.section| sectionname |externalFile.}, but make your call in another section than [special:begin]

why?
i think {.load.} does well.