Advertisement:

Author Topic: [SOLVED] Viewing listing image opens in browser, not in slideshow/new window  (Read 2523 times)

ben_dchost1

  • Jr. Member
  • **
  • Posts: 92
Hi,

I'm not sure if this is an issue with bender or osclass 3.4.x, but when I click on an image in listing it opens up in the browser, forcing the user to press back to get back to the page...

I can't remember if there is supposed to be a slider or something to view the images, but if this is a complicated issue to solve I would settle for the image opening in a new window, maybe through adding target="_blank" somewhere? But I have no idea where, please help :)
« Last Edit: September 17, 2014, 03:06:49 pm by ben_dchost1 »

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: Viewing listing image opens in browser, not in slideshow/new window
« Reply #1 on: September 16, 2014, 06:29:54 pm »
it should open in a light box. check if you have js conflict with another plugin. and that you did not get a bug in the loop (if has resources...)

frosticek

  • Hero Member
  • *****
  • Posts: 3948
Re: Viewing listing image opens in browser, not in slideshow/new window
« Reply #2 on: September 17, 2014, 12:49:47 am »
@ben_dchost1
If image is opened in new window, it means there is javascript error on your site that blocks fancy code to load ;)
Check your web and I am 100% sure there are errors...

ben_dchost1

  • Jr. Member
  • **
  • Posts: 92
Re: Viewing listing image opens in browser, not in slideshow/new window
« Reply #3 on: September 17, 2014, 12:09:45 pm »
thanks for the replies :). I think there is definitely an error, when I use chrome dev tools it shows that there is a "reference error: bender is not defined?" What does this mean and do you guys know how to fix it?

Feel free to have a look if you need to:
http://officesincambridge.co.uk/offices/office-for-rent/office-for-sale_i37

thanks

here is the error:
http://i.imgur.com/Az0obGP.png

frosticek

  • Hero Member
  • *****
  • Posts: 3948
Re: Viewing listing image opens in browser, not in slideshow/new window
« Reply #4 on: September 17, 2014, 12:31:12 pm »
@ben_dchost1
You call function that was not defined yet.

ben_dchost1

  • Jr. Member
  • **
  • Posts: 92
Re: Viewing listing image opens in browser, not in slideshow/new window
« Reply #5 on: September 17, 2014, 12:49:07 pm »
@ben_dchost1
You call function that was not defined yet.

thanks for reply. that makes sense, so would I need to identify the .js file which was trying to call that function on move it further down the list (so it gets loaded later) to give it a chance for the function to be defined? Is that how to fix?

Thanks

frosticek

  • Hero Member
  • *****
  • Posts: 3948
Re: Viewing listing image opens in browser, not in slideshow/new window
« Reply #6 on: September 17, 2014, 01:01:07 pm »
@ben_dchost1
Correct, something like this ;)

ben_dchost1

  • Jr. Member
  • **
  • Posts: 92
Re: Viewing listing image opens in browser, not in slideshow/new window
« Reply #7 on: September 17, 2014, 01:13:15 pm »
@ben_dchost1
Correct, something like this ;)

SO I've identified global.js in 3 files:
oc-content/themes/bender/common/head.php
oc-includes/osclass/gui/head.php
oc-includes/osclass/gui/common/head.php

So in the oc-content/themes/bender/common/head.php
Code: [Select]
<?php
    $js_lang 
= array(
        
'delete' => __('Delete''bender'),
        
'cancel' => __('Cancel''bender')
    );
    
osc_enqueue_script('jquery');
    
osc_enqueue_script('jquery-ui');
    
osc_register_script('global-theme-js'osc_current_web_theme_js_url('global.js'), 'jquery');
    
osc_register_script('delete-user-js'osc_current_web_theme_js_url('delete_user.js'), 'jquery-ui');
    
osc_enqueue_script('global-theme-js');
?>

I've changed it to this:
Code: [Select]
<?php
    $js_lang 
= array(
        
'delete' => __('Delete''bender'),
        
'cancel' => __('Cancel''bender')
    );
    
osc_enqueue_script('jquery');
    
osc_enqueue_script('jquery-ui');   
    
osc_register_script('delete-user-js'osc_current_web_theme_js_url('delete_user.js'), 'jquery-ui');
    
osc_enqueue_script('global-theme-js');
    
osc_register_script('global-theme-js'osc_current_web_theme_js_url('global.js'), 'jquery');
?>

this has had no impact, do I need to repeat the process in the other 2 locations OR do I need to move it out of the <php> brackets and keep moving it down the page (in a new set of <php> i.e. <php osc_register_script('global-theme-js', osc_current_web_theme_js_url('global.js'), 'jquery');?> - and move it down the file?

thanks

aide2001

  • Guest
Re: Viewing listing image opens in browser, not in slideshow/new window
« Reply #8 on: September 17, 2014, 01:17:12 pm »
In your bender theme folder open common/head.php.

Find this code and add semicolon (;) at the end of 4th line:
Code: [Select]
<script type="text/javascript">
    var bender = window.bender || {};
    bender.base_url = '<?php echo osc_base_url(true); ?>';
    bender.langs = <?php echo json_encode($js_lang); ?>; // add semicolon here
    bender.fancybox_prev = '<?php echo osc_esc_js( __('Previous image','bender')) ?>';
    bender.fancybox_next = '<?php echo osc_esc_js( __('Next image','bender')) ?>';
    bender.fancybox_closeBtn = '<?php echo osc_esc_js( __('Close','bender')) ?>';
</script>

Cut the whole javascript and paste it after <?php osc_run_hook('header') ; ?>, so it should look like this:
Code: [Select]
<?php osc_run_hook('header') ; ?>
<script type="text/javascript">
    var bender = window.bender || {};
    bender.base_url = '<?php echo osc_base_url(true); ?>';
    bender.langs = <?php echo json_encode($js_lang); ?>';
    bender.fancybox_prev = '<?php echo osc_esc_js( __('Previous image','bender')) ?>';
    bender.fancybox_next = '<?php echo osc_esc_js( __('Next image','bender')) ?>';
    bender.fancybox_closeBtn = '<?php echo osc_esc_js( __('Close','bender')) ?>';
</script>

This should work
« Last Edit: September 17, 2014, 03:40:19 pm by aide2001 »

ben_dchost1

  • Jr. Member
  • **
  • Posts: 92
Re: Viewing listing image opens in browser, not in slideshow/new window
« Reply #9 on: September 17, 2014, 01:37:03 pm »
In your bender theme folder open common/head.php.

Find this code and add semicolon (;) at the end of 4th line:
Code: [Select]
<script type="text/javascript">
    var bender = window.bender || {};
    bender.base_url = '<?php echo osc_base_url(true); ?>';
    bender.langs = <?php echo json_encode($js_lang); ?>; // add semicolon here
    bender.fancybox_prev = '<?php echo osc_esc_js( __('Previous image','bender')) ?>';
    bender.fancybox_next = '<?php echo osc_esc_js( __('Next image','bender')) ?>';
    bender.fancybox_closeBtn = '<?php echo osc_esc_js( __('Close','bender')) ?>';
</script>

Cut the whole javascript and paste it after <?php osc_run_hook('header') ; ?>, so it should look like this:
Code: [Select]
<?php osc_run_hook('header') ; ?>
<script type="text/javascript">
    var bender = window.bender || {};
    bender.base_url = '<?php echo osc_base_url(true); ?>';
    bender.langs = <?php echo json_encode($js_lang); ?>;
    bender.fancybox_prev = '<?php echo osc_esc_js( __('Previous image','bender')) ?>';
    bender.fancybox_next = '<?php echo osc_esc_js( __('Next image','bender')) ?>';
    bender.fancybox_closeBtn = '<?php echo osc_esc_js( __('Close','bender')) ?>';
</script>

This should work

Hi Aide thanks for reply,

I tried this (semicolon was already present) but this does not seem to work... it also screws up the display of the website. http://officesincambridge.co.uk/offices/office-for-rent/office-for-sale_i37
More specifically if I try this:
Code: [Select]
<?php osc_run_hook('header') ; ?>
<script type="text/javascript">
    var bender = window.bender || {};
    bender.base_url = '<?php echo osc_base_url(true); ?>';
    bender.langs = <?php echo json_encode($js_lang); ?>;
    bender.fancybox_prev = '<?php echo osc_esc_js__('Previous image','bender')) ?>';
    bender.fancybox_next = '<?php echo osc_esc_js__('Next image','bender')) ?>';
    bender.fancybox_closeBtn = '<?php echo osc_esc_js__('Close','bender')) ?>';
</script>
it makes no difference (excect for breaking display)
BUT if I try this:
Code: [Select]
<script type="text/javascript">
    var bender = window.bender || {};
    bender.base_url = '<?php echo osc_base_url(true); ?>';
    bender.langs = <?php echo json_encode($js_lang); ?>;
    bender.fancybox_prev = '<?php echo osc_esc_js__('Previous image','bender')) ?>';
    bender.fancybox_next = '<?php echo osc_esc_js__('Next image','bender')) ?>';
    bender.fancybox_closeBtn = '<?php echo osc_esc_js__('Close','bender')) ?>';
</script>
<?php osc_run_hook('header') ; ?> //on bottom
It does seem to try and load something, but the image does not get displayed,

tomshaft

  • Hero Member
  • *****
  • Posts: 862
  • Osshaft for Osclass - Add 650 posts to my total
Re: Viewing listing image opens in browser, not in slideshow/new window
« Reply #10 on: September 17, 2014, 02:33:27 pm »
Sorry for jumping in but looks like your missing the " ' " at the end:
bender.langs = <?php echo json_encode($js_lang); ?>;

Should be:
Code: [Select]
bender.langs = <?php echo json_encode($js_lang); ?>';


But I could be mistaken..... :o
 
I see your not loading the main.css file in head.php?
Code: [Select]
<link href="<?php echo osc_current_web_theme_url('css/main.css') ; ?>?<?php echo rand(0pow(105)); ?>" rel="stylesheet" type="text/css" />
<?php osc_run_hook('header') ; ?>


Tom
« Last Edit: September 17, 2014, 02:41:22 pm by tomshaft »

ben_dchost1

  • Jr. Member
  • **
  • Posts: 92
Re: Viewing listing image opens in browser, not in slideshow/new window
« Reply #11 on: September 17, 2014, 02:49:42 pm »
Sorry for jumping in but looks like your missing the " ' " at the end:
bender.langs = <?php echo json_encode($js_lang); ?>;

Should be:
Code: [Select]
bender.langs = <?php echo json_encode($js_lang); ?>';


But I could be mistaken..... :o
 
I see your not loading the main.css file in head.php?
Code: [Select]
<link href="<?php echo osc_current_web_theme_url('css/main.css') ; ?>?<?php echo rand(0pow(105)); ?>" rel="stylesheet" type="text/css" />
<?php osc_run_hook('header') ; ?>


Tom

thanks for reply, yes I think you are correct that it might have been missing the "' ' " but it does mean I've also had to add on at the start so it's now:
Code: [Select]
bender.langs = [color=red]'[/color]<?php echo json_encode($js_lang); ?>[color=red]'[/color];
But if I go on website still opens in the same window...

tomshaft

  • Hero Member
  • *****
  • Posts: 862
  • Osshaft for Osclass - Add 650 posts to my total
Re: Viewing listing image opens in browser, not in slideshow/new window
« Reply #12 on: September 17, 2014, 03:00:17 pm »
I am confused by your response but if all is well then great...?
If not then sorry for jumping in.
 
Tom

ben_dchost1

  • Jr. Member
  • **
  • Posts: 92
Re: Viewing listing image opens in browser, not in slideshow/new window
« Reply #13 on: September 17, 2014, 03:06:33 pm »
Update

The slider is finally loading!! Shifted a few things across and applied some of your changes and it works  ;D

However, I am not experiencing another problem, but I will start a new thread (http://forums.osclass.org/bender/viewing-images-from-items-is-not-central/msg106204/#msg106204) since it is no longer related to this thread (image is now not displaying centrally)

thanks again!

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: [SOLVED] Viewing listing image opens in browser, not in slideshow/new window
« Reply #14 on: September 17, 2014, 09:02:03 pm »
what version of bender are you using? hopefully the new one, but as I read these comments it seems you are using the old version. (missing commas and semi colons)