Tag Archives: xenforo

Conditional statements for url in XenForo templates

[gard]
If  you need to check a conditional statement in your XenForo template for a specific part of a url just use the following syntax:

<li id="menu-item-14" class="<xen:if is="{$requestPaths.requestUri} == '/community/marketplace/categories/marketplace.7/'"> current-menu-item</xen:if>"><a href="http://www.xsimulator.net/community/marketplace/categories/marketplace.7/">Marketplace</a></li>

In this example, if the current Url is

'/community/marketplace/categories/marketplace.7/'

the class will be extended with

current-menu-item

I use that piece of code to get the current page link in in the main navigation of the XSimulator forum.
[gard]

phpinfo in XenForo

XenForo 1.2 You ll find the phpinfo() when you log into your admin panel and than add the following parameter to the admin url admin.php?tools/phpinfo

There is no direct link to it in the admin panel, so thats a really „nice to know“.

XenForo Nginx rewrite rules configuration for friendly url

[gard]
Use the following configuration file to run your XenForo forum installation delivered by the Nginx webserver with friendly urls:

The rules are very simple:

Open your nginx.conf (You often in /etc/nginx):

Inside the server block {} insert two location related sections:

location / {
try_files $uri $uri/ /index.php?$uri&$args;
}

location ~ /(internal_data|library) {
internal;
}

The first location block specifies the url rewriting process. The second location part prevents external access to the internal XenForo related data structures. Thats for security purposes of the forum installation.

If you forum is located within a subfolder like e.g. domain.com/forum or domain.com/community just add the name of the subfolder to the location parts:

location /forum/ {
try_files $uri $uri/ /forum/index.php?$uri&$args;
}

location ~ /forum/(internal_data|library) {
internal;
}

Restart the nginx webserver.

All done. Your XenForo installation should be running fine now with search engine friendly urls like domain.com/forum/this-is-my-post.2
[gard]