we_universal

Random header image we_universal - we_universal

Random header image we_universal

by PELP » Mon Dec 14, 2015 10:03 am

I have yet another issue I am trying to resolve on http://www.fritforum.dfac.dk. For the time being I am working on it on this URL http://www.pelp.dk/phpbb.

I am trying to get random header image to work on we_universal.
I have followed the instructions here: https://inventea.com/en/projects/we_universal/faq#10

My edited part of functions.php looks like this:

// Path to directory with header images (must contain trailing slash)
$inventea_images_path = "{$web_path}styles/" . rawurlencode($user->theme['theme_path']) . '/theme/headers/';

// Get list of images in directory
$inventea_images_list = array_diff(scandir($inventea_images_path), array('.', '..'));

if (!empty($inventea_images_list))
{
// Get random image name
$inventea_random_image =$inventea_images_list[array_rand($inventea_images_list)];
}

My edited part of overall_header.html looks like this:

<header class="inventea-header">
<div class="inventea-dashboard" style="background-image: url({INVENTIA_RANDOM_IMAGE});" role="banner">
<!-- EVENT overall_header_navbar_before -->
<!-- INCLUDE navbar_header.html -->

<div class="inventea-sitename">
<h1><a href="<!-- IF U_SITE_HOME -->{U_SITE_HOME}<!-- ELSE -->{U_INDEX}<!-- ENDIF -->" title="<!-- IF U_SITE_HOME -->{L_SITE_HOME}<!-- ELSE -->{L_INDEX}<!-- ENDIF -->">{SITENAME}</a></h1>
<span>{SITE_DESCRIPTION}</span>
</div>
</div>
</header>

The images are all .jpg 1170 x 240 pixels uploaded to /we_universal/images/headers directory.

When I access pelp.dk/phpbb I get this screen:

2015-12-12.png



If I insert we_universal/ in the line in functions.php that defines the header directory like this: "$inventea_images_path = "{$web_path}styles/we_universal/" . rawurlencode($user->theme['theme_path']) . '/theme/headers/';" I don´t get the error messages, but I still don´t get a header image. It is as if the theme_path is not defined, and even if it is the images are not found.

What am I doing wrong?

I am an absolute novice as far as HTML and PHP are concerned, but I do have quite a good understanding of arrays, variables and procedures from programing in the good old DOS days (UniComal).
Yours truly
Poul Erik Lind Pedersen
Denmark
PELP
Registered User
Posts: 71
Joined: Sun Nov 22, 2015 4:14 pm
Name: Poul Erik Lind Pedersen
Contact:

Re: Random header image we_universal

by sw2000 » Sat Jan 02, 2016 10:27 am

Had actually the same problem and after lots of "try and try again" method i got it working.

You need to change two words in your functions.php

In the line find rawurlencode($user->theme['theme_path'])

Code: Select all

// Path to directory with header images (must contain trailing slash)
$inventea_images_path = "{$web_path}styles/" . rawurlencode($user->theme['theme_path']) . '/theme/headers/';


Change "theme" to "style"

Code: Select all

// Path to directory with header images (must contain trailing slash)
$inventea_images_path = "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/headers/';


Hope this works for you too.

Admin @ Talo
User avatar
sw2000
Registered User
Posts: 213
Joined: Fri Oct 24, 2003 3:11 pm
Contact:

Re: Random header image we_universal

by PELP » Sun Jan 03, 2016 3:05 pm

Thanks a lot sw2000.

That did the trick. I had solved it temporarily by inserting a static path, but then it would only work with we-universal. This wasn´t really a problem as 100% of our users use we_universal, so it was just a matter of setting that as board default style and not giving options to choose.

But this is much better and works like a charm.
Yours truly
Poul Erik Lind Pedersen
Denmark
PELP
Registered User
Posts: 71
Joined: Sun Nov 22, 2015 4:14 pm
Name: Poul Erik Lind Pedersen
Contact: