Log in

View Full Version : Caching phrasegroups


The Geek
11-30-2005, 08:32 PM
Is this not possible? Ive been working all night on this, yet I cant for the life of me find out how to do this!

one would assume that since global is merging phrasegroups:
$phrasegroups = array_merge($phrasegroups, $actionphrases["$_templatedo"]);

You would still have time to add to them, but its not working. The above line is between the fetch_style and cache_template hooks with no function calls between but it doesnt make a difference which one you use - it wont fetch the phrasegroups you are after. :P

Help me Calgon. Take me away.

Marco van Herwaarden
11-30-2005, 08:46 PM
I guess you already debuged the value of $phrasegroups after the merge?

The Geek
11-30-2005, 08:52 PM
er. Thanks Marco. It was one of those situations where you rip the house apart to find your freaking keys only to discover that they are in your pocket :P

Please delete this thread before people discover Im a n00b coding on a comadore64 with FrontPage.

Actually, maybe im not a n00b. I was getting a false positive because I merged the phrasegroup array with the fetch_user_info hook as a test.
Only problem is that at that stage, I cant consistantly tell which forum im in, so it doesnt really work for me :(

Marco van Herwaarden
11-30-2005, 09:05 PM
Hmm strange, added the following to Fetch_style:
$phrasegroups = array_merge($phrasegroups, array('cpglobal'));
And it shows up nice in the $phrasegroups in global, but it doesn't seem to retrieve the phrases.

Must look more into this tomorrow if i have time, probably something i already solved and forget again once.

Marco van Herwaarden
11-30-2005, 09:06 PM
Lol then i better also delete my reply. :D

Probably too late to think clear.

Nahh will leave it here for some to have a laugh.

Andreas
11-30-2005, 10:59 PM
style_fetch is too late => init_startup

The Geek
12-02-2005, 03:23 PM
Thanks Andreas - but isnt that too early for $forumid?

Andreas
12-02-2005, 03:41 PM
Yup. That's the reason why I did not port my "Langage by Forum" Hack, as it requires restructuring global.php ;)

If you look at global.php, you can see that the language is initialized before forumids are available.

The Geek
12-02-2005, 04:01 PM
I know its not totally a bug per say, but clearly there are more phrasegroups added between the style_fetch hook and cace_templates hook however adding those phrasegroups cant really do anything.

Seeing as 'you de man' now, do you think you can petition the hook gods to give us one thats in a slightly better position ;)

Andreas
12-02-2005, 04:15 PM
Hooks won't help in this case, even if every line of global.php had a Hook :)

Take a look at how the code is sructured - as said above, the forumid is not available before the language is initialized.

The Geek
12-02-2005, 05:11 PM
I think you misunderstood me,

What I mean is that there IS code in vanilla global.php between those hooks adding to the phrasegroup. My point was that it was obviously a mistake.

Furthermore I was begging in a rather distasteful fashion for someone to contemplate putting a hook between $forumid setting and language construction :)

Thanks!

Andreas
12-02-2005, 05:32 PM
Yes, there is code - but it actually does ... nothing :)

putting a hook between $forumid setting and language construction
As I've been trying to explain in the last few posts, this is not possible.

init_language() ... if (postid) if (threadid) if (forumid) if (pollid) => forumid found

The Geek
12-02-2005, 09:24 PM
gotacha. Surely the forumid discovery code could go before language initialization. Forumid discovery doesnt require language initialization.

Or maybe im up in the night, Im just speaking off the cuff :)

Andreas
12-03-2005, 01:45 AM
That would be a possiblility, but as said: With the current code structure it is not possible to have a Hook between forumid detection and langage initialization ;)

mostof
05-20-2006, 05:48 PM
OK Forumid are not available during language initialization...
what about styleid?

can i play around with the language being initialized depending on teh style chosen? If so, can someone please give me an example on how to go about this?

Thanks and best regards....