xoops forums

domecc

Just popping in
Posted on: 2007/8/9 3:09
domecc
domecc (Show more)
Just popping in
Posts: 71
Since: 2005/10/30
#1

How to use smarty plugin "xoAppUrl" and "xoImgUrl"?

I've learned Mor.pho.GEN.e.sis, but confused by the usage of "xoAppUrl" and "xoImgUrl".

Sometime <{xoAppUrl}>, but sometime <{xoAppUrl /}>.
Sometime <{xoAppUrl viewpmsg.php}>, but sometime <{xoAppUrl /search.php}>.
Sometime <{xoImgUrl style.css}>, but sometime <{xoImgUrl /style.css}>

Should I use "/" after "xoAppUrl" and "xoImgUrl"?
XoopsChina Webmaster

script_fu

Friend of XOOPS
Posted on: 2007/8/9 4:20
script_fu
script_fu (Show more)
Friend of XOOPS
Posts: 1494
Since: 2002/12/27
#2

Re: How to use smarty plugin "xoAppUrl" and "xoImgUrl"?

Quote:

domecc wrote:
Sometime <{xoImgUrl style.css}>, but sometime <{xoImgUrl /style.css}>


Off topic:

Be careful with this one. Think about it...

Why would you use an img url to pull a style sheet?

I can tell you first hand that IE did pull the sheet.
Firefox is a whole other issue. FF does not know what the code is. It took me three days to figure out that code above was incorrect.

Sorry for going off topic on you. Maybe one of the devs can shed some light on your questions

snow77

Just can't stay away
Posted on: 2007/8/9 6:34
snow77
snow77 (Show more)
Just can't stay away
Posts: 864
Since: 2003/7/23
#3

Re: How to use smarty plugin "xoAppUrl" and "xoImgUrl"?

Quote:
It took me three days to figure out that code above was incorrect.


Where, when and what is the code that is working wrong?

xoImgUrl and xoAppUrl have been working fine for me with or without slash.

If there is a rule of when to use the slash and when not. The developers of XOOPS should know about the "architecture" to give a better response. But I'm not sure where you'll get a response of the architecture... probably at the sourceforge forums.

kris_fr

Theme Designer
Posted on: 2007/8/9 7:34
kris_fr
kris_fr (Show more)
Theme Designer
Posts: 1009
Since: 2005/12/31
#4

Re: How to use smarty plugin "xoAppUrl" and "xoImgUrl"?

Hello,

These two smarty work very well, for an explanation concerning those, I invite you to read the annotations and comments in the files root/class/smarty/xoops_plugins/compiler.xoImgUrl.php and compiler.xoAppUrl.php

I a long time now use them in my topics since good, and I did not encounter any difficulty. It should be known that henceforth it is these smartys which it will be necessary for us to use in the themes and templates as well as the modules

The use of “/” does not obstruct the operation of the link, you can put it or not, on the other hand if you do not have a filename behind you must put it. If not right the name of the directory/filename

@++

script_fu

Friend of XOOPS
Posted on: 2007/8/9 9:52
script_fu
script_fu (Show more)
Friend of XOOPS
Posts: 1494
Since: 2002/12/27
#5

Re: How to use smarty plugin "xoAppUrl" and "xoImgUrl"?

Quote:

snow77 wrote:
Where, when and what is the code that is working wrong?



xpro_042_gamingV2
<link rel="stylesheet" type="text/css" media="all" title="Blue" href="<{xoImgUrl /style.css}>" />


xpro_043_gamingV3
<link rel="stylesheet" type="text/css" media="all" title="Blue" href="<{xoImgUrl /style.css}>" />


FireFox has no idea what this code is and will always load style.css

I can not get styleNN.css to load with the XD examples above.

--------------

I changed the code in the XD theme.html's to...

<link rel="stylesheet" type="text/css" media="screen" href="<{$xoops_themecss}>" />


Then my styleNN.css loads and takes effect.

script_fu

Friend of XOOPS
Posted on: 2007/8/9 10:32
script_fu
script_fu (Show more)
Friend of XOOPS
Posts: 1494
Since: 2002/12/27
#6

Re: How to use smarty plugin "xoAppUrl" and "xoImgUrl"?

This page cannot be displayed due to an internal error.

You can provide the following information to the administrators of this site to help them solve the problem:

Error: Smarty error: [in /themes/XGv3_Blue/theme.html line 16]: syntax error: unrecognized tag: xoImgUrl/style.css (Smarty_Compiler.class.php, line 436)

----------
xoImgUrl/style.css = Smarty Errors
---
xoImgUrl /style.css = Nothing but style.css in FireFox
----------

I thought maybe it was the white space so I closed it. lol

Nope...

I will just keep this for now.

<link rel="stylesheet" type="text/css" media="screen" href="<{$xoops_themecss}>" />

kris_fr

Theme Designer
Posted on: 2007/8/9 17:46
kris_fr
kris_fr (Show more)
Theme Designer
Posts: 1009
Since: 2005/12/31
#7

Re: How to use smarty plugin "xoAppUrl" and "xoImgUrl"?

hi,

just delete files in templates_c, may be

@++

script_fu

Friend of XOOPS
Posted on: 2007/8/9 19:07
script_fu
script_fu (Show more)
Friend of XOOPS
Posts: 1494
Since: 2002/12/27
#8

Re: How to use smarty plugin "xoAppUrl" and "xoImgUrl"?

Wonderful...

I did mention above that the styleNN.css works fine in firefox with the old style sheet code from the XOOPS default theme.

Also that it does not work with the xoImgUrl

So in order to get this far! It means we already know how to delete templates_c, cache & hit the reload button.

Maybe I should state.
Php 5
MySql 5
FireFox 2.0.0.6

Maybe this is the reason it does not work.

kris_fr

Theme Designer
Posted on: 2007/8/9 19:12
kris_fr
kris_fr (Show more)
Theme Designer
Posts: 1009
Since: 2005/12/31
#9

Re: How to use smarty plugin "xoAppUrl" and "xoImgUrl"?

Why you want a leaf styleNN.css, just style.css is enough
If your Css is in conformity you will not have any concern some is the navigator

skenow

Home away from home
Posted on: 2007/8/20 17:44
skenow
skenow (Show more)
Home away from home
Posts: 993
Since: 2004/11/17
#10

Re: How to use smarty plugin "xoAppUrl" and "xoImgUrl"?

A little digging turned this up -

function xoops_getcss($theme '')
{
    if (
$theme == '') {
        
$theme $GLOBALS['xoopsConfig']['theme_set'];
    }
    
$uagent xoops_getenv('HTTP_USER_AGENT');
    if (
stristr($uagent'mac')) {
        
$str_css 'styleMAC.css';
    } elseif (
preg_match("/MSIE ([0-9].[0-9]{1,2})/i"$uagent)) {
        
$str_css 'style.css';
    } else {
        
$str_css 'styleNN.css';
    }
    if (
is_dir(XOOPS_THEME_PATH.'/'.$theme)) {
        if (
file_exists(XOOPS_THEME_PATH.'/'.$theme.'/'.$str_css)) {
            return 
XOOPS_THEME_URL.'/'.$theme.'/'.$str_css;
        } elseif (
file_exists(XOOPS_THEME_PATH.'/'.$theme.'/style.css')) {
            return 
XOOPS_THEME_URL.'/'.$theme.'/style.css';
        }
    }
    if (
is_dir(XOOPS_THEME_PATH.'/'.$theme '/css')) {
        if (
file_exists(XOOPS_THEME_PATH.'/'.$theme.'/css/'.$str_css)) {
            return 
XOOPS_THEME_URL.'/'.$theme.'/css/'.$str_css;
        } elseif (
file_exists(XOOPS_THEME_PATH.'/'.$theme.'/css/style.css')) {
            return 
XOOPS_THEME_URL.'/'.$theme.'/css/style.css';
        }
    }
    return 
'';
}


In a nutshell - $xoops_themecss gets its value from this function and this function uses the browser agent to determine which stylesheet to use - styleMAC, styleNN, or style.

The Smarty variables are documented in the wiki