Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

Use forum css on another page.

Aloittaja Harro, toukokuu 10, 2006, 02:22:51 IP

« edellinen - seuraava »

Harro

I'm trying to integrate a link exchange directory with my MKPortal.
MKportal is using the forum's template.
But that link directory page is in an inframe inside the portal.
That page has no layout at all (Here's the link: http://harro.sin.khk.be/index.php?pid=2 )

Is it possible to let the page inside the iframe use the css file of the theme that a member is using?

Kindred

if the page calls for the CSS file....
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Harro

Yes, but how can I get that css file?
I want the css file of the theme the member is using and the default if it's a guest.

Kindred

in that case, you will have to "include" SSI in order to get the member data and then use an if else statement...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Harro

#4
Found nothing that gets the member data in SSI.php
There is however a function in Load.php called loadUserSettings();
But to be honest I don't know what to do with it.
Saw that there is a var    $user_info that contains an array with all the information of the member.
But how can I use this on my other page?


[edit]
Managed to get the theme_id the user is using. (I think...)
<?php
require(
"/home/users/members/hwbk/harro/public_html/forums/SSI.php"); 

loadUserSettings();

$theme_id $user_info['theme'];
echo $theme_id;

?>


Let's see if I can get the link to the css file now :)

bloc

Maybe even simpler than that...something like this in the <head> section?

<?php
require_once('pathtoSSI.php');
global 
$settings;

echo 
'<link rel="stylesheet" type="text/css" href="'$settings['theme_url'], '/style.css?rc2" />';
?>


SSi takes care of the loading of user/guest settings, so you really don't need to do that yourelf - only check the variables.

Harro

Thanks a lot.
Just managed to do it, but your way is a lot easier ;)

Although I'm proud off myself ;)

Here's the code I had:


<?php
require(
"/home/users/members/hwbk/harro/public_html/forums/SSI.php"); 
loadUserSettings();
$theme_id $user_info['theme'];
loadTheme($ID_THEME $theme_id$initialize true);
$theme_dir $settings['theme_url'];
$theme_css $theme_dir "/style.css";
?>


<html>
<head>
<link rel="stylesheet" type="text/css" href="<?php echo $theme_css ?>" />
</head>


Thanks a lot for the help!!

bloc

:) Glad to help. Thats how i started out too..by exploring and learning bit by bit.

Harro

Just curious....
style.css?rc2
Why is the ?rc2 after the style.css?

bloc

It will make sure any changes in style.css will be present right away. The browser updates its cache when something is attached to the filename.

Harro

Oh, K.
I get it :)
Thanks for explaining it!

Advertisement: