Author Topic: Macros  (Read 74633 times)

0 Members and 1 Guest are viewing this topic.

Offline TSG

  • Operator
  • Tireless poster
  • *****
  • Posts: 1934
    • View Profile
    • RAWR-Designs
Re: Macros
« Reply #225 on: February 04, 2009, 08:58:33 AM »
Are you trying to show breadcrumbs or what? I am slightly confused....

You cant talk to macro with JavaScript without using post or get form data. Or AHAH, for example. Macro is Server Side, JavaScript is Client Side.

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12949
    • View Profile
Re: Macros
« Reply #226 on: February 04, 2009, 09:46:45 AM »
Code: [Select]
<script type="text/javascript">
var path = document.location.pathname;
var dir = path.substring(path.indexOf('/', 1)+1, path.lastIndexOf('/'));
</script>
{.set|directory|dir.}

as TSG says, your macro will run BEFORE the javascript, because it runs on the server, while javascript on the client.
try using %folder% instead.

Offline Chrisp6825

  • Occasional poster
  • *
  • Posts: 20
    • View Profile
Re: Macros
« Reply #227 on: February 04, 2009, 01:49:07 PM »
Dang.. %folder%. I knew about that. I dont know why I didn't think about it. haha
Thanks. And no this isnt for bread crums.

Offline Mars

  • Operator
  • Tireless poster
  • *****
  • Posts: 1890
    • View Profile
Re: Macros
« Reply #228 on: February 04, 2009, 06:55:58 PM »
about breadcrumbs: rejetto, can you simply modify the code source with this line?

result:=result+xtpl(p, [ '%bread-url%', e, '%bread-name%', ad[ i],'%bread-idx%', inttostr(i)
]);  //mod by mars 2009

He will add simply the variable %bread-idx% which allows to obtain the level of the sub-directory with as value 0 for the root.

I know that you will still ask me to justify the usefulness of such a variable ;D. to me it just seems obvious that there is a small hole to fill ;)


Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12949
    • View Profile
Re: Macros
« Reply #229 on: February 05, 2009, 11:37:06 AM »
being a very little thing i don't need explanations about it. ;)
i would like to know if you or anyone would use it...

the point is not "hole to fill" or "easy to make".
more complex it is, more useful it should be to justify its existence.
i didn't invent this rule! http://fr.wikipedia.org/wiki/Principe_KISS ;)

i may also decide to include this thing without explanation, but this is not the general rule i try to apply to hfs development.
i'm sorry you see it as a caprice.
« Last Edit: February 05, 2009, 11:39:25 AM by rejetto »

Funboss

  • Guest
Re: Macros
« Reply #230 on: August 13, 2009, 02:01:51 PM »
if they made a shoutbox, you can make a guestbook

But shoutbox uses external server. My HFS is established in the local network without the output into the Internet; therefore I want so that the messages in the guest book would remain locally in the same machine, where was established HFS

If you want to keep it simple, you can use an iframe in your template. Use php to create a simple and very costumizable shoutbox. You can use a text file instead of a database. You can use the usernames (%user%). Search the forum for 'Funboss Iframe' for more info about this. There is no need to use an external server, right?

Else { Forget my comment!  ;) }