WebsiteBaker Support (2.8.x) > Templates, Menus & Design

Bs_naturak - wrong slider images on corresponding pages

(1/4) > >>

elfinlay:
Hello,

I have a question about Bs_Naturak. I have the slider up and running, the images correspond to the captions, and the links go to the correct pages.

However, I can't seem to get the linked pages to display the corresponding images. Eg: page 34 displays slide2.jpg, but its link on the slider displays slide3.jpg. Is it possible to fix this?

My code is below:

This is the code from miniheader.php:

<?php
if(!defined('WB_URL')) { header('Location: ../../../index.php'); exit(0); }

$slidenr = ($page_id % 3) + 1
?>

Here is the code from index.php (I've linked the images through the media directory so others can upload easily. They are displaying fine) :

$slider_page_ids = '28,26,34';
$slider_image_base = MEDIA_DIRECTORY.'/slide'; // added: number + .jpg

Any suggestions anyone could give me would be greatly appreciated.

Many thanks,

Emily.

jacobi22:
it looks like a little error, when the script count the array $slider_page_ids or in the picture names

i've written a german description about this problem and try to translate this
the original-code count the parts of the array $slider_page_ids. your code

--- Code: ---$slider_page_ids = '28,26,34';
--- End code ---
means, show me the pics  slide28.jpg, slide26.jpg, slide34.jpg as slide1.jpg, slide2.jpg, slide3.jpg, named as slide+number + .jpg, located in the defined folder

--- Code: ---$slider_image_base = WB_URL.MEDIA_DIRECTORY.'/slide'
--- End code ---

why slide1.jpg, slide2.jpg, slide3.jpg?
its the number of the array-key

for more specific definition ($slider_page_ids == your wished page-links to the pages with id == 28, 26 or 34

go to the file snippets/responsive-slider.php and change the line 44 from $nr = $i; to $nr = $page_id;
and rename the pictures to the needed page_id

example
picture slide3.jpg is the wished pic for page with id == 34, so rename it to slide34.jpg

fischstäbchenbrenner:

--- Quote ---why slide1.jpg, slide2.jpg, slide3.jpg?
its the number of the array-key
--- End quote ---

There is a simple reason:
The Template does not know, which page you will have in $slider_page_ids
So there are some example numbers.

Of course the best would be to use picture like $page_id + ".jpg"
But in this case, the Template would have to contain masses of pictures.

See /templates/bs-naturak/snippets/responsiveslides.php


--- Code: ---while($page = $query_pages->fetchRow()) {
$i++;
$page_id = $page['page_id'];
$nr = $i; //Use $page_id OR $i for picture numbers. $i (1, 2, 3...)  is easier to handle, $page_id is mor specific.
...

--- End code ---

simple replace $nr = $i;  with $nr = $page_id;
Better replace all $page_id with $p_id to prevent from conflicts

elfinlay:
Thanks both for taking the time to reply. It is greatly appreciated!

I've tried changing the slide numbers to accord with the desired page numbers and replaced  $nr = $i; to $nr = $page_id; in the responsive-slider.php file.

When I do this, the slider images load in the correct order, however the static images on the pages do not correspond. Eg: page 26 displays slide34 and page 34 displays slide26.

I then tried replacing all $page_id with $p_id to prevent conflicts, as suggested by fischstäbchenbrenne r.

When I do this, though, all pages have the slider as a header, rather than static images.

Here is some more of the code from index.php:


--- Code: ---if (!isset($p_id) OR $p_id==4 OR $p_id==4) {
include('snippets/responsiveslides.php');
include('snippets/nav.php');
include('snippets/site-headline.php');
} else {
include('snippets/miniheader.php');
include('snippets/nav.php');
}

include('snippets/playground.php');
include('snippets/2col-content.php');
--- End code ---

Once again, I'm very grateful for your responses!

elfinlay:
I've just discovered something that is probably related to the source the problem.

I have redirected the slider to the MEDIA folder, rather than the bs_naturak/img folder in the TEMPLATE_DIR.

I have changed the code as below:


--- Code: ---$slider_page_ids = '26,28,34';
$slider_image_base = MEDIA_DIRECTORY.'/slide'; // added: number + .jpg
--- End code ---

As I said, this makes the images display in the slider fine. However, I have just noticed that if I go back to the templates/bs_naturak/img folder and rename the slide files to correspond to the pages (slide26.jpg, slide28.jpg, slide34.jpg) they disappear altogether.

This seems to suggest that, while the slider is calling on the media folder, the pages are calling on the templates/bs_naturak/img folder.

I can't seem to locate any other instances of  TEMPLATE_DIR.'/img/slide' // added: number + .jpg  in the code.

Would anybody be able to tell me whether there is a separate call to the templates/bs_naturak/img folder for the page header images?

Many thanks, again.

Navigation

[0] Message Index

[#] Next page

Go to full version