Log in

View Full Version : problems with autosubmitting templates and phrases


Ron1n
07-04-2005, 04:59 PM
Meh, ok... im really sort of confused here.

I am making an installer script for a hack - and I wanted to have it autosubmit different phrases and templates. Everything seems to be going OK on the admincp side of things, but when I access the hack it gives me tons of errors.

When I submit the templates and rebuild styles the new templates are visible in the admincp style editor, but when I access them in my mod they give me errors like:Parse error: parse error, unexpected '{' in /home/mdzaman/public_html/demo2/downloads.php(832) : eval()'d code on line 2
That '{' error refers to {$stylevar['htmldoctype']}
When I was testing this out, I found that when I click save on the template in the admincp it fixes the problem - but I dont know why. I tried searching for the template submission code in vBulletin but I didnt find anything that stood out.

When I submit phrases, they are visible when searched for and when I am viewing all phrase groups, but my own phrase group (downloads, id=411) is not visible and I cannot find out why. Furthermore, when I try to cache phrasegroups for the specific page $phrasegroups = array('downloads'); I get a vbulletin database error when viewing the page.

If someone could help solve some/all of these problems ... that would be great. Thanks for reading down this far - hopefully you have an answer.

Andreas
07-04-2005, 05:13 PM
What do you mean with "autosubmit"?

Ron1n
07-04-2005, 06:04 PM
What do you mean with "autosubmit"?Where the install script (my code) inserts templates/phrases so the user doesnt have to.

function create_phrase($phrase)
{
global $downloads, $db;
$db->query_write("INSERT INTO `phrase` (`languageid`,`varname`,`text`,`phrasetypeid`,`pro duct`) VALUES(".
prep($downloads['phrase'][$phrase]['languageid']).",".
prep($downloads['phrase'][$phrase]['varname']).",".
prep($downloads['phrase'][$phrase]['text']).",".
prep($downloads['phrase'][$phrase]['phrasetypeid']).",".
prep($downloads['phrase'][$phrase]['product']).")");
}

function create_template($template)
{
global $downloads, $db;
$db->query_write("INSERT INTO `template` (`styleid`,`title`,`template`,`template_un`,`datel ine`,`username`,`product`) VALUES(".
prep(-1).",".
prep($template).",".
prep($downloads['template'][$template]).",".
prep($downloads['template'][$template]).",".
prep(TIMENOW).",".
prep('Ronin').",".
prep($downloads['product']).")");
}

But btw, I do rebuild styles and languages after editing, and ... yea - i think i explained the rest.

Andreas
07-04-2005, 06:08 PM
You are not compiling the Templates ...

Ron1n
07-04-2005, 06:20 PM
You are not compiling the Templates ...Ok, checking that out. Any suggestions about the phrases not showing up?

Andreas
07-04-2005, 06:22 PM
Are you using an existing Phrasetype?
If not: Have you altered Table language and inserted a record in Table Phrasetype?

Ron1n
07-04-2005, 11:24 PM
I submit a phrasetype and a table in language...
function delete_phrasetype()
{
global $downloads, $db;
$db->query_write("DELETE FROM `phrasetype` WHERE `phrasetypeid`=".prep($downloads['phrasetype']['id'])." AND `product`=".prep($downloads['phrasetype']['product']));
$db->query_write("ALTER TABLE `language` DROP `phrasegroup_" . $downloads['phrasetype']['fieldname'] . "`");
}

function create_phrasetype()
{
global $downloads, $db;
$db->query_write("INSERT INTO `phrasetype` (`phrasetypeid`,`fieldname`,`title`,`product`) VALUES(".
prep($downloads['phrasetype']['id']).",".
prep($downloads['phrasetype']['fieldname']).",".
prep($downloads['phrasetype']['title']).",".
prep($downloads['phrasetype']['product']).")");
$db->query_write("ALTER TABLE `language` ADD `phrasegroup_" . $downloads['phrasetype']['fieldname'] . "` MEDIUMTEXT NOT NULL");
}

Any other suggestions?

Andreas
07-04-2005, 11:33 PM
Yes - use add_phrase_type() in adminfunctions_language.php instead of your own function :)

Ron1n
07-05-2005, 12:11 AM
mmk.

When removing it, is there anything I need to remove that I didnt before - or is there a function to remove it? (I didnt see a remove function in the same file as the add function you just showed me).

Edit: i found the problem, it was the editrows thing. Personally, I dont want to use that add_phrase_type thing until vBulletin supports add_phrase_type and remove_phrase_type for OCD reasons. :P

Thanks for your help :D