Advertisement:

Author Topic: [Tricks] Bender default to gallery view  (Read 16190 times)

mmcsus

  • Hero Member
  • *****
  • Posts: 704
  • Open Source
[Tricks] Bender default to gallery view
« on: May 07, 2013, 12:35:37 am »
Find attached gallery_main.php

Rename your oc-content/themes/bender/main.php to something else.

Rename this attachment to main.php and save to --> oc-content/themes/bender.

Note: This is for "Bender" theme, not for bender_red or bender_purple or  ... etc.

... end.

#############################################

If you want to set  gallery view to default in "main", "search" and "user dashboard" forget the above and do this:

Paste the following code to the end of your oc-content/themes/your_bender/js/global.js

Code: [Select]
$(document).ready(function(){
  $('.grid-button').click();

 });

This works in all bender themes.

 ... end.



« Last Edit: May 07, 2013, 05:17:41 am by mmcsus »

s51

  • Sr. Member
  • ****
  • Posts: 309
Re: [Tricks] Bender default to gallery view
« Reply #1 on: May 07, 2013, 01:14:26 am »
.
Hi mmcsus . . .

1.)
>>to main.php and save to your theme . . . . . .
Sorry to say it, - but it does not work in.: bender_red   :(
- -

2.)
OnLine error message:
* Fatal error: Call to undefined function bender_add_boddy_class() in /home/XXXXXXXXXX/domains/XXXXXXXXXX.dk/public_html/s51/oc-content/themes/bender_red/main.php on line 25
and no-no-nanette -it was not the stereo boddy  :P
- -


Best Regards.:/ s51

.

mmcsus

  • Hero Member
  • *****
  • Posts: 704
  • Open Source
Re: [Tricks] Bender default to gallery view
« Reply #2 on: May 07, 2013, 02:26:29 am »

Hi s51,

Yes, I should have put a note to reflect that.

You can add code to the other colors like so:

In the attachment above find around line 38:

Code: [Select]
<a href="<?php echo osc_update_search_url(array('sShowAs'=> 'gallery')); ?>" id="dgallery" class="grid-button" data-class-toggle="listing-grid" data-destination="#listing- ...
In your bender color add --> id="dgallery"

At the end of your bender color main.php add the following: (Use above attachment as guide)

Code: [Select]
<script type="text/javascript">
$(document).ready(function(){
  $('#dgallery').click();

 });
</script>

Just so other members know, this is telling jQuery to push the gallery button after the page loads.



trains58554

  • Osclass contributor
  • Hero Member
  • *****
  • Posts: 3642
  • osCanyon, the class of Osclass
Re: [Tricks] Bender default to gallery view
« Reply #3 on: May 07, 2013, 02:31:06 am »
OnLine error message:
* Fatal error: Call to undefined function bender_add_boddy_class() in /home/XXXXXXXXXX/domains/XXXXXXXXXX.dk/public_html/s51/oc-content/themes/bender_red/main.php on line 25
and no-no-nanette -it was not the stereo boddy  :P

The reason you got this error is because in each of the bender themes they use different function names so the function for the bender red theme should be bender_red_add_boddy_class() on line 25 of the min.php file.

Jay

s51

  • Sr. Member
  • ****
  • Posts: 309
Re: [Tricks] Bender default to gallery view
« Reply #4 on: May 07, 2013, 03:54:27 am »
.
Hi u2 Usa,ske gentlemen.: mmcsus and Trains58554


1
.)
Yep - this time it keep responsivity in both Iphone & Ipad = deluXe   8)
and in the main page it now start up in = gallery mode
- -

2.)
But mmcsus can you also find the next.: jQuery push to gallery button ?
why,,,
because in the search page, it still start up in the list mode,
it should also be gallery mode.   THANKS in advance
- -

3.)
Holy cow,,, these style sheets are not too tired old men (my time is now 02:17)
And Trains58554 I might have misunderstood
>>should be bender_red_add_boddy_class()  = any case I can not get it to work ?
- -


Best Regards.:/ s51

.

mmcsus

  • Hero Member
  • *****
  • Posts: 704
  • Open Source
Re: [Tricks] Bender default to gallery view
« Reply #5 on: May 07, 2013, 04:46:24 am »
Hi s51,

If you want to set  gallery view to default in main, search and user dashboard forget the above and do this:

Paste the following code to the end of your oc-content/themes/your_bender/js/global.js

Code: [Select]
$(document).ready(function(){
  $('.grid-button').click();

 });

This works in all bender themes.



MadBoy92

  • Newbie
  • *
  • Posts: 3
Re: [Tricks] Bender default to gallery view
« Reply #6 on: May 07, 2013, 04:41:55 pm »
Thank you, mmcsus! But, when the page load in search bar of the browser appear this : http://MY_SITE/search/sShowAs,gallery/ ... How to remove this, to be only http://MY_SITE.com..
Regards!

s51

  • Sr. Member
  • ****
  • Posts: 309
Re: [Tricks] Bender default to gallery view
« Reply #7 on: May 08, 2013, 12:09:19 pm »
.
Hi mmcsus . . . and Madboy92 & trains58554 ...


1.)
>>search/sShowAs,gallery/
Exactly,,, unfortunately
This also applies to search engines, who now see the address as: \www.bla.bls.\dk\search\sShowAs,gallery\
and users who which stores the address in their browser favorites: \www.bla.bls.\dk\search\sShowAs,gallery\
- -

2.)
* But now to the weird stuff
Have any of you noticed, - it only happens in newer browsers ?
On my inhouse server Fujitsu Siemens Celsius born with XP proff. and IE8
everything is displayed correctly ! (both OffLine and OnLine)
Yes and ..ALSO.. the category view in main page moving up nicely aligned under each other,
and ..ALSO.. with mmcsus js code inserted, the browser address showing correct,
- -

3.)
On our other ,,inhouse,, PC,s a: small 11" with G.Chrome and a 16" with IE (shift) 9 between 10
they all fail, - showing main categories etc. wrong, - and mmcsus,s insert JS as: \search\sShowAs,gallery\
on Iphone4s and Ipad 3g horizontal and vertical tilt works perfectly - and grid show is much better i handhelds,
But:
Unfortunately the Apple gadgets also fails, with regard to browsing adress. as:  \search\sShowAs,gallery\
- -

4.)
mmcsus like you I have through trawlet Chris Coyer,s page in a flimsy hope of finding precedents,
I,m not a coder, - but I __think__ it's about ,,old,, core code, - that will not work with the new responsive code ?
*
Regardless all of the above, - I still believe firmly in responsive code, - as code for the tomorrow future, - there is no other way.   ;)
- -


Best Regards to you all.: / s51
.

MadBoy92

  • Newbie
  • *
  • Posts: 3
Re: [Tricks] Bender default to gallery view
« Reply #8 on: May 08, 2013, 06:37:55 pm »
i just found, that when i load my site from google, it`s only domain without >>search/sShowAs,gallery/... We must remove this code, to load only domain. But How?!

bwakad247

  • Full Member
  • ***
  • Posts: 221
Re: [Tricks] Bender default to gallery view
« Reply #9 on: May 12, 2013, 01:32:58 am »
To add the script part in the js file is not a good solution because it will lead directly to the search page.
there has to be a better solution for only grid mode and staying on the page where you are at that moment.

EDIT:
see my next topic on this same subject for allround solution.
« Last Edit: May 12, 2013, 03:41:43 am by bwakad247 »

bwakad247

  • Full Member
  • ***
  • Posts: 221
Re: [Tricks] Bender default to gallery view - new simple way
« Reply #10 on: May 12, 2013, 02:33:36 am »
In main.php, just change this:
Code: [Select]
<ul class="listing-card-list" id="listing-card-list">to this:
Code: [Select]
<ul class="listing-grid" id="listing-card-list"> /*to get the starting grid list mode */

in main.css add this line  (where all the listing classes are):
Code: [Select]
.listing-grid {clear: both} /* this is to keep the h1 and action button on it's own line */

Now for who clicks the button to go to table mode you will notice in the url it will lead you to the search page.
If you would like it to stay on the main page, you should change the url. Look after this part:
Code: [Select]
<span class="doublebutton etc. of the main.php page, and change the parts that says (there are 2):
Code: [Select]
<?php echo osc_update_search_urlto:
Code: [Select]
<?php echo osc_base_url. /*with index.php in browser adres bar*/
or:
Code: [Select]
<?php echo osc_base_url($with_index false) /* without index.php in browser adres bar */

then I addded this code to the bottom of global.js:
Code: [Select]
$(document).ready(function(){
  $('.grid-button').click();
 });
So that the button appears to be active on gridmode.

Of course (because of the js part) you only have to change the main.php (to keep it from going to th search page) because any other page (search page) automatically responds to the added js part.

Hope this helps people.
« Last Edit: May 12, 2013, 05:52:08 am by bwakad247 »

Legion

  • Hero Member
  • *****
  • Posts: 622
  • I am founder of top20remedies.com buyeradvise.com
Re: [Tricks] Bender default to gallery view
« Reply #11 on: May 12, 2013, 04:23:01 pm »
hello mmcsus

can i use this gallary on modern theme at seach.php? kindly reply

mmcsus

  • Hero Member
  • *****
  • Posts: 704
  • Open Source
Re: [Tricks] Bender default to gallery view
« Reply #12 on: May 12, 2013, 07:26:31 pm »
@ Legion

No, I don't think so at least without a lot of work.

Proventa

  • Newbie
  • *
  • Posts: 34
Re: [Tricks] Bender default to gallery view - new simple way
« Reply #13 on: May 15, 2013, 08:45:57 pm »
In main.php, just change this:
Code: [Select]
<ul class="listing-card-list" id="listing-card-list">to this:
Code: [Select]
<ul class="listing-grid" id="listing-card-list"> /*to get the starting grid list mode */

in main.css add this line  (where all the listing classes are):
Code: [Select]
.listing-grid {clear: both} /* this is to keep the h1 and action button on it's own line */

Now for who clicks the button to go to table mode you will notice in the url it will lead you to the search page.
If you would like it to stay on the main page, you should change the url. Look after this part:
Code: [Select]
<span class="doublebutton etc. of the main.php page, and change the parts that says (there are 2):
Code: [Select]
<?php echo osc_update_search_urlto:
Code: [Select]
<?php echo osc_base_url. /*with index.php in browser adres bar*/
or:
Code: [Select]
<?php echo osc_base_url($with_index false) /* without index.php in browser adres bar */

then I addded this code to the bottom of global.js:
Code: [Select]
$(document).ready(function(){
  $('.grid-button').click();
 });
So that the button appears to be active on gridmode.

Of course (because of the js part) you only have to change the main.php (to keep it from going to th search page) because any other page (search page) automatically responds to the added js part.

Hope this helps people.

doesnt seems to work good... I mean, when you enter the page the grid looks all messy.

bwakad247

  • Full Member
  • ***
  • Posts: 221
Re: [Tricks] Bender default to gallery view
« Reply #14 on: May 16, 2013, 02:30:35 am »
well, what exactly did you do? because mine looks great!?