PDA

View Full Version : How to auto template?


pein87
06-23-2009, 03:13 AM
I am working on a new mod and i was wondering how do you auto template? I tried to auto template the header and footer template but without any results. I go the database to install and uninstall but the auto template isnt working. I tried

$tempmod = $vbulletin->db->query_read(" SELECT * FROM " . THREAD_PREFIX. " WHERE title=\"headinclude\" ");
$temp = $vbulletin->db->fetch_array($tempmod);
$find = '<!-- /CSS -->';
$replace = '<!-- /CSS -->
<link rel="stylesheet" type="text/css" href="rpg/rpg.css">
';

str_replace($find, $replace, $temp['template']);

str_replace($find, $replace, $temp['template_un']);


No luck with that is there anyway to do it that I dont know? I'm trying to position the edits at the end of the css comment and at the end of the footer template. I would appreciate it if anyone could help me on this.

Dismounted
06-23-2009, 09:53 AM
If you are wanting to add something inside the header, just concatenate on the $headinclude variable.

Carnage
06-23-2009, 11:56 AM
You arn't saving it back to the database for starters...

second, you are only modifying the first found template; if there are multiple styles and one has a customised template in it... it wont work

Easiest thing to do for auto template mods is to modify the template cache in global.php

pein87
06-24-2009, 01:50 PM
I see so I would just use the $headinclude varible instead of accessing the database? Sorry its early here and I havent sleep a wink in the past 24 hrs. Could you give an example please?