MyBB Community Forums
Add forum's CSS to a custom PHP file - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: Add forum's CSS to a custom PHP file (/thread-170225.html)



Add forum's CSS to a custom PHP file - michael.b - 2015-05-01

Hello guys!

I added a custom PHP file to my server's root.

I'm using <object> HTML tag to show it to my forum's index.
The problem is that I need to make my script to display with the same CSS as my forum's.

My forum URL is http://forum.ad-rp.ga.

Looking forwards for tips.


RE: Add forum's CSS to a custom PHP file - .m. - 2015-05-01

what is the link of your custom php file ?


RE: Add forum's CSS to a custom PHP file - michael.b - 2015-05-01

http://forum.ad-rp.ga/server.php

As you can notice, it displays only simple text. I want to apply my forum's CSS attributes to it.


RE: Add forum's CSS to a custom PHP file - .m. - 2015-05-01

it would be better to use OUGC pages plugin or this method for the custom php file


RE: Add forum's CSS to a custom PHP file - michael.b - 2015-05-01

It seems it's not working how I want to, especially when using <frame> or <object> HTML tags. I tried to directly add the PHP code into my index HTML template, but it's not working too.


RE: Add forum's CSS to a custom PHP file - .m. - 2015-05-01

you may PM me your requirement and temporary access to forum admin panel & files (FTP)

however its about midnight for me & I can check it tomorrow


RE: Add forum's CSS to a custom PHP file - Johnny S - 2015-05-01

Try with following edit(s):

In your server.php file at the top, before <?php that contains code that is pulling your server status
add
<?php

define("NO_ONLINE", 1);
define("IN_MYBB", 1);
define('THIS_SCRIPT', 'server.php');

require_once "./global.php";

$tid = $theme['tid'];

?>

<style type="text/css">
@import url(cache/themes/theme<?php echo $tid ?>/global.css);
</style>

<?php the rest of your php code ?>


RE: Add forum's CSS to a custom PHP file - michael.b - 2015-05-02

Thanks, I'll give it a try!

Edit: Well, it its working, somehow, but it does not takes the font of my CSS. The text only takes my forum's background and text color.

See at http://forum.ad-rp.ga.

Fixed, thanks to everybody for help!