1. 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:

Discussion in 'Troubleshooting and Problems' started by Edgeworth E. Euler, Sep 19, 2011.

  1. [​IMG]

    How can I fix this?

    My setup is nginx/php5-fpm, behind a loadbalancer behind cloudflare.

    It used to work, but all of the sudden, it's stopped! :O
  2. EQnoble

    EQnoble Well-Known Member

    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. I'm using chrome.
    All the other admins of my forums (who use different browsers) report the same error.
  4. EQnoble

    EQnoble Well-Known Member

    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.
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    EQnoble likes this.
  6. I am now being hit with the following error:
  7. ragtek

    ragtek Guest

  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
  9. It's hanging on the following statement:
    INSERT INTO xf_template_compiled (style_id, language_id, title, template_compiled) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE template_compiled = VALUES(template_compiled)
  10. Also, looing at SHOW ENGINE INNODB STATUS;,

    There are no locked transactions :\
  11. 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.
  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You can pass the node_id using xen:container. See this post:


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

    <xen:if is="{$forumId} == 2">
    	<img src="path/to/image/for/nodeid2.jpg" />
    A condition like this will work in the templates after you setup xen:container per that post.
    Edgeworth E. Euler likes this.
  13. 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...

    <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'}'}
  14. zaiger

    zaiger Active Member

    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.
  15. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Hey that's my guide. ;)


    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:

    <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">
    count: {$count}
    Put this in your templates. You will see that {$count} equals 4.
    zaiger likes this.
  16. Ouch, I guess we'll just manually set the $count variable in each if block, to avoid running an empty loop :p

Share This Page