11
studioC
Re: "exclude" some php code for my theme.html
  • 2005/4/5 20:51

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


perhaps i misread your question, but

include XOOPS_ROOT_PATH.'/themes/yourtheme/script.php';

at the end of header.php (before ?> though)
and putting that php stuff (this is the script.php ):
<?php
$mod 
$GLOBALS['xoopsModule'];
$dirname = (isset($mod) ? $mod->getVar('dirname') :'system');
$GLOBALS['xoopsTpl']->assign'xoops_cmod'$dirname );
?>

assigning smarty will work too ...

12
simeon
Re: "exclude" some php code for my theme.html
  • 2005/4/5 20:56

  • simeon

  • Not too shy to talk

  • Posts: 104

  • Since: 2003/12/18


but this would be just a half-solution cause i will distribute this theme to the xoopsers and i spend much time to make all the path´s relative just to let the theme be plug&playable.

i think its contra productive if i hardcode some things for a theme.
isnt there any other solution for that?

13
studioC
Re: "exclude" some php code for my theme.html
  • 2005/4/5 20:58

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


the smarty must be there BEFORE rendering the theme.html

michael

14
simeon
Re: "exclude" some php code for my theme.html
  • 2005/4/5 21:09

  • simeon

  • Not too shy to talk

  • Posts: 104

  • Since: 2003/12/18


this is definitv not what i want to hear.
but why it works when i put the code into the theme directly?that should be impossible if the smarty have to be set before rendering the theme.
if theres no other solution i have to let it in the theme directly, the solution with the header makes no sense to me

15
studioC
Re: "exclude" some php code for my theme.html
  • 2005/4/5 21:14

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


Quote:
this is definitv not what i want to hear.

haha ... sure ..

Quote:
i spend much time to make all the path´s relative just to let the theme

uuuh?
perhaps you can tell us a bit mor what you want to achieve .. there are always more possibilities to catch that cow

16
simeon
Re: "exclude" some php code for my theme.html
  • 2005/4/5 21:40

  • simeon

  • Not too shy to talk

  • Posts: 104

  • Since: 2003/12/18


[ger]mußt dir halt mal die includes.php anschaun zu der ich ein paar posts vorher gelinkt hab.
das theme KANN die farbe wechseln (r,g,b) und von 800px zentriert auf fullscreen switchen.das ganze wird dann natürlich in cookies gespeichert damits auch anhaltend is.
funzt auch alles super, bis auf die 100 zeilen php code am anfang der theme die mich zwar net wirklich stören aber die übersichlichkeit a bissl beeinträchtigen find ich.aber bleibt halt nix anderes übrig als es so zu lassen wenn das mit dem auslagern net hinhaut.
ich denk ich werd in 14 tagen fertig haben, hab noch einiges zu tun weil ich modul templates für ein paar module mitgeb die sich net mit der 800er breite vertragen und das layout sonst crashen würden.
[/ger]

17
tjnemez
Re: "exclude" some php code for my theme.html
  • 2005/4/6 5:13

  • tjnemez

  • Home away from home

  • Posts: 1594

  • Since: 2003/9/21


@sudioc
anziehende Kühe 101 vorbei studioC
ich liebe Ihre Sayings

i used babel fish for this

18
simeon
Re: "exclude" some php code for my theme.html
  • 2005/4/6 18:55

  • simeon

  • Not too shy to talk

  • Posts: 104

  • Since: 2003/12/18


rofl tjnemez

i see translation from english to german works as nice as in the other way

19
studioC
Re: "exclude" some php code for my theme.html
  • 2005/4/6 20:47

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


@tjnemez

hey terry yes this is exactly what i said . Now i understand why you won't talk with me in english via icq

btw. did you managed to get icq installed ?
michael

20
AAINC
Re: "Include" some php code into my theme.html
  • 2005/4/6 23:36

  • AAINC

  • Not too shy to talk

  • Posts: 121

  • Since: 2003/10/18


you can call in php files in your theme from your theme directory like this.
<{include_php file="$xoops_rootpath/themes/your_theme/your_file.php"}>


This only brings the php file code into the theme.
You still need to execute it inside the theme.


An example of this is Ryuji PM hack.

this is the php file inside your theme directory.
ex_assign.php

<?php
// $Id$
// FILE        ::    ex_assign.php
// AUTHOR    ::    Ryuji AMANO <info@joetsu.info>
// WEB        ::    Ryu's Planning <http://ryus.joetsu.info/>
//

global $xoopsUser$xoopsModule;
if (
is_object($xoopsUser)) {
    
$pm_handler =& xoops_gethandler('privmessage');

    
$criteria = new CriteriaCompo(new Criteria('read_msg'0));
    
$criteria->add(new Criteria('to_userid'$xoopsUser->getVar('uid')));
    
$this->assign("ex_new_messages"$pm_handler->getCount($criteria));
}

if ( 
is_object($xoopsModule) ) {
    
$this->assign('ex_moduledir'$xoopsModule->getVar('dirname'));
}

?>


Now to call into theme.html you place this below the body tag of the theme.html.

<{include_php file="$xoops_rootpath/themes/Your_Theme/ex_assign.php"}>


Now to execute this example of code into theme.html you use something like this inside the theme.html.

<{if $ex_new_messages 1}>
<
a href="<{$xoops_url}>/viewpmsg.php">Private Messages</a>
<{/if}>
<{if 
$ex_new_messages 0}>
<{if 
$smarty.server.SCRIPT_NAME == "/index.php"}>
<
script language="javascript" type="text/javascript">
<!--
msg="<b>Hello! <{$xoops_uname}></b><br />You have <span style='color:#ff0000; font-weight: bold;'><{$ex_new_messages}></span> new Message(s)";
openwin (msg)
function 
openwin(message) {
open("""message""width=250,height=150,toolbar=no,scrollbars=yes,resizable=yes");
w.focus();
w.document.open();
w.document.write("<html><head></head><meta http-equiv='content-type' content='text/html; charset=<{$xoops_charset}>' /><title>You've Got Messages</title><body><br><br><center>");
w.document.write(message);
w.document.write("<br /><br /><a href="javascript:window.opener.location='<{$xoops_url}>/viewpmsg.php';window.close();">");
w.document.write("View</a>");
w.document.write("</center></body></html>");
w.document.close();
}
// -->
</script>
<{/if}>
<
a  href="<{$xoops_url}>/viewpmsg.php">
<
span style="color:#ff6600;"><{$ex_new_messages}>-Message(s)
</
span></a>
<{/if}>



Now with the above code, if you have any PM's the number of PM's will show next to the static link 'Private Messages'. A popup will also happen when you enter your index page telling you number of PM's.

I hope this example of the PM hack helps you.

PEACE

::::EDITED:::::
without the whistles and bells of the popup and link, all you have to do to execute the code in the above example is place this in the theme.html:

<{$ex_new_messages}>


Login

Who's Online

231 user(s) are online (143 user(s) are browsing Support Forums)


Members: 0


Guests: 231


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits