The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
||||
|
||||
Just as idea, without testing anything:
Code:
<vb:if condition="in_array($type, $selectedtypes)"> checked</vb:if> |
#12
|
|||
|
|||
I think the problem is the preRegister statement, it should be like this:
PHP Code:
|
#13
|
|||
|
|||
Quote:
The current problem, is the parsing of the vbulletin conditional when using safe_function "in_array" -- it is failing validation. I have fixed this problem at work so when I get a chance I am going to snoop at my code. With your fix, his code should work, if he forces a save of the template. |
#14
|
|||
|
|||
Quote:
I know nobody else is editing anything. So not sure what is going on there. I have also updated my plugin to what was suggested above - thanks for that! I also have that conditional you found in the search_common templace, so that would mean that vBulletin does accept it? Or it's just forced a save? Thanks for your help everyone. Cheers --------------- Added [DATE]1412297432[/DATE] at [TIME]1412297432[/TIME] --------------- I attempted to put the Code:
<vb:if condition="in_array($type, $selectedtypes)"> checked="checked"</vb:if> Which is strange since it is being used in the search_common template. |
#15
|
|||
|
|||
Quote:
--------------------------------------------------------- Quote:
Let me know if you still have trouble forcing the save of the template. I do have this problem resolved on my main systems (something I fixed a long time ago), but the code cannot easily be ported and would make you non vb standard, so I am working on a easy circumvent for the problem. |
#16
|
|||
|
|||
How long does an invalid session take to time out?
I attempted this first yesterday, and then tried it first thing today, and it still came up with the 'Someone else is editing' message. Thanks for your ongoing support. Cheers |
#17
|
|||
|
|||
Quote:
I still can't force save the template which is frustrating - always comes up with the 'Someone else is editing at the same time' message. I'm trying to think if there's another way I can get the parentid that I need. Thanks, hilaryl |
#18
|
|||
|
|||
In my own code, I fixed some small issues with the lexer, some minor issues with the parsers, and beefed up some error routines. Most of these issues were found due to us extending the templating system. The average user has probably never run into any of these issues, unless they have used the templating system extensively. vBulletin allows you to force a save on almost all errors, it gets around the few validation problems on the stock conditionals, curly, and tag definitions. That was a smart move on their part.
I am not posting the other fixes. I doubt most users will want to alter their source files or have a need for the patches. At this point only someone expanding the templater system would be interested and they are welcome to contact me. This particular fix will assist the beginner templater as single errors were not being displayed correctly. This did impact you with the safe-function "in_array". Replace function in "/includes/function.php" with the new function below. Sorry, this cannot be done via a plugin. PHP Code:
|
#19
|
|||
|
|||
Thanks tbworld.
Ideally we would like to do as little modifying as possible to the core files. I have actually found a way that works better for what I am trying to achieve - and it validates in the template! Instead of trying to compare the whole parentlist array (690,610,-1) I've created variables in the custom plugin that are assigned to specific keys in the array (each forum id level). Code:
// Get the second last key in the array and assign it to a variable $grandparent = $parentarray[count($parentarray)-2]; Now I can access the variable in my template like this Code:
<vb:if condition="in_array($grandparent, array(13,62))"> It's working </vb:if> Thanks for all your replies everyone. Talking it out and looking at the possible options has helped me understand better what I can do/need to do. Thanks, hilaryl |
Благодарность от: | ||
tbworld |
#20
|
|||
|
|||
Here is some conditional usage that you may want to ponder. Of course all of this can and maybe should be done in PHP, but sometimes this is more fun. I discovered quite a few interesting things when enhancing the template system.
One of the things I modified in the template system is a 'break' for the 'each' conditional. I am pointing this out, because in the crazy example below the routine continues to iterate the array and we may have already found our resultant. Code:
<vb:comment> Iterates an array for basically no reason, and if a value was found in the array the create a new variable inside the template for altering a dynamic response. (tbworld method) </vb:comment> <vb:each from="show" key="show_key" value="show_value"> <vb:comment> <!-- Just to show usage --> key: {vb:var show_key} <br> value: {vb:var show_value}<br> </vb:comment> <!-- Check for existance of key in $show --> <vb:if condition="array_key_exists('member', $show) AND (!isset($newvar))"> <div>Array Key Exists!</div> <!-- create or set a value to a variable --> <vb:if condition="$newvar='Yes we created a new variable $newvar!'"></vb:if> </vb:if> </vb:each> <!-- Display the new variable we just created --> <dl> <dd>Did we create a new variable?</dd> <dt>{vb:raw newvar}</dt> </dl> <!-- --------------------------------------------------------------- --> <!-- Key exists if not NULL --> <vb:if condition="isset($show['member'])">--isset test --<br /></vb:if> <!-- Expansion on the above examples, Use with caution! --> <!-- Create a new Array --> <vb:if condition="$new_array = array('member', 'fruit', 'fish')" ></vb:if> <!-- Create a new Key field variable --> <vb:if condition="$new_test_key='member'"></vb:if> <!-- Create a variable resultant --> <vb:if condition="$resultant=in_array($new_array[$new_test_key], $show, false)" >Test Key exist in $show array<br /></vb:if> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|