• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

When trying to save a template, I get the following error:

EQnoble

Well-known member
#2
did you by chance have firebug open while doing that....

I have noticed a bug with firebug that gives me the same error with any submit action be it templates or posts or at almost any site which I can submit data. I fixed it by copying the text i didn't want to lose, made sure firebug was not enabled on the domain in question and refreshed the page. After that I could submit info again. I don't know if this is related to your issue but if you use firebug try that above.
 
#3
did you by chance have firebug open while doing that....

I have noticed a bug with firebug that gives me the same error with any submit action be it templates or posts or at almost any site which I can submit data. I fixed it by copying the text i didn't want to lose, made sure firebug was not enabled on the domain in question and refreshed the page. After that I could submit info again. I don't know if this is related to your issue but if you use firebug try that above.
I'm using chrome.
All the other admins of my forums (who use different browsers) report the same error.
 

EQnoble

Well-known member
#4
I'm using chrome.
All the other admins of my forums (who use different browsers) report the same error.
Lol my bad didn't even notice that...

I can't help you with this other than what I have said as that (w/ firebug) is the only time I have seen that error myself. Wish I could help.

Hopefully someone familiar with your type of server config catches this thread.
 

Jake Bunce

XenForo moderator
Staff member
#9
Lock wait timeout exceeded
That is a different timeout error. Similar problem as before except it is coming from MySQL.

If you have root access to the server then you can edit the my.cnf file (usually at /etc/my.cnf) to increase the value of innodb_lock_wait_timeout. Increasing that limit should avoid this error.

Or again you can remove some styles to speed up the cache rebuild and avoid these timeouts.
 
#10
That is a different timeout error. Similar problem as before except it is coming from MySQL.

If you have root access to the server then you can edit the my.cnf file (usually at /etc/my.cnf) to increase the value of innodb_lock_wait_timeout. Increasing that limit should avoid this error.

Or again you can remove some styles to speed up the cache rebuild and avoid these timeouts.
It's hanging on the following statement:
Code:
INSERT INTO xf_template_compiled (style_id, language_id, title, template_compiled) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE template_compiled = VALUES(template_compiled)
 
#12
I guess, the styles must be at fault here, maybe you could provide an alternate solution then...

We rotate different header / graphics for each subforum, is there a way, or even an addon that could do that for us with out the need for extra styles? :O

Would be pretty awesome, I could write one myself, if anyone could point me in the right direction as well.
 

Jake Bunce

XenForo moderator
Staff member
#13
We rotate different header / graphics for each subforum, is there a way, or even an addon that could do that for us with out the need for extra styles? :O
You can pass the node_id using xen:container. See this post:

http://xenforo.com/community/threads/language-attribute.15249/#post-200171

That will allow you to use conditions to check the node_id. For example:

Code:
<xen:if is="{$forumId} == 2">
	<img src="path/to/image/for/nodeid2.jpg" />
</xen:if>
A condition like this will work in the templates after you setup xen:container per that post.
 
#14
Thanks :)

One more quick question, is there a way to get the length of an array, or a random element from an array? We're currently doing...

HTML:
<xen:set var="$banners.1"><center><img src="http://static.encyclopediadramatica.ch/edf/edfbit11banner.jpg" /></center></xen:set>
/* snip */
<xen:set var="$banners.20"><center><img src="http://static.encyclopediadramatica.ch/edf/edoibanner.png" /></center></xen:set>

{xen:raw '$banners.{xen:calc '({$serverTime} % 20) + 1'}'}
 

zaiger

Active member
#15
We only have the rotating banner in 4 styles though out of 10. We can cut that down to 5 styles now for 24 boards. I think it should work fine.
 

Jake Bunce

XenForo moderator
Staff member
#16
Hey that's my guide. ;)

http://xenforo.com/community/threads/display-a-random-banner.19563/

That code already displays a random element from the array with that modulo calculation. The only way I know of to get the length of an array using template syntax is with xen:foreach. For example:

Code:
<xen:set var="$banners.1">banner one</xen:set>
<xen:set var="$banners.2">banner two</xen:set>
<xen:set var="$banners.3">banner three</xen:set>
<xen:set var="$banners.4">banner four</xen:set>

<xen:foreach loop="$banners" value="$curBanner" i="$i" count="$count">
</xen:foreach>

count: {$count}
Put this in your templates. You will see that {$count} equals 4.
 
#17
Hey that's my guide. ;)

http://xenforo.com/community/threads/display-a-random-banner.19563/

That code already displays a random element from the array with that modulo calculation. The only way I know of to get the length of an array using template syntax is with xen:foreach. For example:

Code:
<xen:set var="$banners.1">banner one</xen:set>
<xen:set var="$banners.2">banner two</xen:set>
<xen:set var="$banners.3">banner three</xen:set>
<xen:set var="$banners.4">banner four</xen:set>

<xen:foreach loop="$banners" value="$curBanner" i="$i" count="$count">
</xen:foreach>

count: {$count}
Put this in your templates. You will see that {$count} equals 4.
Ouch, I guess we'll just manually set the $count variable in each if block, to avoid running an empty loop :p