MyBB Community Forums

Full Version: Inserting Material Design Lite API into Flatty
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to edit the Flatty theme into a material theme by integrating material design lite and changing how things look.
I looked around the XML file but couldn't find a place where I could put the hosted URLs as each has their own template and I don't want to insert for each one in case of API changes.
Is there a way I can insert
<head>
   <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
   <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
</head>
<body>
   <script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
</body>
Thanks
There are many possible solutions for your issue. First and the easiest one would be to insert your code inside the headerinclude template for each one of your theme (from the ACP, not the XML theme file). This obviously will require you updating the template for each theme every time the library gets updated, that isn't really a problem unless the library gets updated too frequently (I doubt it) or you just don' want to bother ("meh").

Other solution would be to use the <template ...> helper of the plugin Template Conditionals. Simply create a template inside the Global Templates set ("foor" for this example) and paste your code there, then inside each of the headerinclude templates paste<templates foo>. Then you only will need to worry about one updating one template and one not cached template query.

A third option would be to do this at the plugin level, hooking to output_page to add whatever code you need inside the header HTML tag. This can be easily achieve by using the Hooks plugin and the str_replace() function.

In my opinion, each one of the solutions is more troublesome that the one before. But you now have three options out of who knows how many else.
(2019-01-31, 12:06 AM)Omar G. Wrote: [ -> ]There are many possible solutions for your issue. First and the easiest one would be to insert your code inside the headerinclude template for each one of your theme (from the ACP, not the XML theme file). This obviously will require you updating the template for each theme every time the library gets updated, that isn't really a problem unless the library gets updated too frequently (I doubt it) or you just don' want to bother ("meh").

Other solution would be to use the <template ...> helper of the plugin Template Conditionals. Simply create a template inside the Global Templates set ("foor" for this example) and paste your code there, then inside each of the headerinclude templates paste<templates foo>. Then you only will need to worry about one updating one template and one not cached template query.

A third option would be to do this at the plugin level, hooking to output_page to add whatever code you need inside the header HTML tag. This can be easily achieve by using the Hooks plugin and the str_replace() function.

In my opinion, each one of the solutions is more troublesome that the one before. But you now have three options out of who knows how many else.

Thanks!
(2019-01-31, 01:43 AM)XeonNetwork Wrote: [ -> ]
(2019-01-31, 12:06 AM)Omar G. Wrote: [ -> ]There are many possible solutions for your issue. First and the easiest one would be to insert your code inside the headerinclude template for each one of your theme (from the ACP, not the XML theme file). This obviously will require you updating the template for each theme every time the library gets updated, that isn't really a problem unless the library gets updated too frequently (I doubt it) or you just don' want to bother ("meh").

Other solution would be to use the <template ...> helper of the plugin Template Conditionals. Simply create a template inside the Global Templates set ("foor" for this example) and paste your code there, then inside each of the headerinclude templates paste<templates foo>. Then you only will need to worry about one updating one template and one not cached template query.

A third option would be to do this at the plugin level, hooking to output_page to add whatever code you need inside the header HTML tag. This can be easily achieve by using the Hooks plugin and the str_replace() function.

In my opinion, each one of the solutions is more troublesome that the one before. But you now have three options out of who knows how many else.

Thanks!

I will also suggest giving material design try in default theme, it will be quite cool Smile