Advertisement:

Author Topic: [SOLVED] changing "index.php" , Bigio theme, removing images, table layout, how?  (Read 720 times)

jerico

  • Newbie
  • *
  • Posts: 12
Hi OsClass gurus :)

I am first time here, experimenting with osClass for past few weeks, I have question if anybody can help it would be great :)

I am using Bigio theme, and want to change default layout of index.php page, I don't want adds with images, i want table layout, just simple table, and when user click on add it will be redirected to default page of single item with image(s) and everything else, so could anybody help with this? :)

Thanks!
« Last Edit: March 10, 2018, 05:16:35 pm by jerico »

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Hello,

You should replace this:

Code: [Select]

                        <div class="col-lg-12 col-md-12 col-sm-12">
                       
                            <div class="row subcategories masonry">
                           
                                <?php while ( osc_has_latest_items() ) { ?>
                                <div class="col-lg-fifth col-md-fifth col-sm-fifth subcategory item">
                               
                               
                                        <?php if( osc_images_enabled_at_items() ) { ?>
                                        <?php if( osc_count_item_resources() ) { ?>
                                                <a href="<?php echo osc_item_url(); ?>">
                                                    <img src="<?php echo osc_resource_original_url(); ?>" width="160" title="<?php echo osc_item_title(); ?>" alt="<?php echo osc_item_title(); ?>" />
                                                </a>
                                            <?php } else { ?>
                                                <a href="<?php echo osc_item_url(); ?>"><img src="<?php echo osc_current_web_theme_url('images/no_photo.png'); ?>" alt="No photo" title="<?php echo osc_item_title(); ?>" width="160" /></a>
                                            <?php ?>
                                                                                    <?php ?>

                                    <div class="product-info">
                                     <h6><a href="<?php echo osc_item_url(); ?>"><?php echo osc_highlightstrip_tagsosc_item_title() ), 33 ); ?></a></h6>
                                     <h5><?php if( osc_price_enabled_at_items() ) { echo osc_item_formated_price() ; } ?></h5> <strong style="color:#FF9900" title="<?php _e('Premium listings''bigio'); ?>"><?php echo (osc_item_is_premium()?" <i class='icons icon-star-3'></i><i class='icons icon-star-3'></i><i class='icons icon-star-3'></i><i class='icons icon-star-3'></i><i class='icons icon-star-3'></i>":""); ?></strong>
                                       
                                    </div>
                                </div>
       

                                <?php ?>
                          </div>
                           
                        </div>


With something like this:

Code: [Select]

                        <div class="col-lg-12 col-md-12 col-sm-12">
                       
                            <div class="row subcategories">
                           
                                <table class="table table-hover">
                                    <thead>
                                        <tr>
                                            <th>Title</th>
                                            <th>Location</th>
                                            <th>Price</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php while ( osc_has_latest_items() ) { ?>
                                            <tr>
                                                <td><a href="<?php echo osc_item_url(); ?>"><?php echo osc_highlightstrip_tagsosc_item_title() ), 33 ); ?></a></td>
                                                <td><?php echo osc_item_city(); ?>, <?php echo osc_item_region(); ?></td>
                                                <td><?php if( osc_price_enabled_at_items() ) { echo osc_item_formated_price() ; } ?></td>
                                            </tr>
                                        <?php ?>
                                    </tbody>     
                                </table>                           
                          </div>


Warning: The code is IS NOT TESTED, but should work.

Regards.

jerico

  • Newbie
  • *
  • Posts: 12
Patrick, thanks for fast response! :)

I will try and report here what happens, once one: great thanks for the fast and useful answer! :)

jerico

  • Newbie
  • *
  • Posts: 12
Patric, I am trying to experinent with "main.php" (in: "site.com\oc-content\themes\bigio\main.php") to try what you suggested to me, but any changes I made are not visible, are yoou sure that file "site.com\oc-content\themes\bigio\main.php" is what is seen in broser as index.php (main page) ? Any advice? :) Simply anything I change is not visible online (even with ctrl + f5 to be sure that browser is forced to not take anything from cache)...

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Well, that's weird... I'lI install the theme later any try to find the problem.

Regards.

jerico

  • Newbie
  • *
  • Posts: 12
patrickFromCroatia, thanks so much! :)

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
I installed the theme on test osclass installation and changed the file as I mentioned in the upper post and everything worked (
). Did you make any other changes to main.php, or maybe edit the wrong file?

My main.php file: https://pastebin.com/XxwSCKRR

Regards.

jerico

  • Newbie
  • *
  • Posts: 12
You are right I was editing wrong file, found right 'main.php' (sorry I said I am noob) :)

Anycase BIG thanks, patrickFromCroatia, for solving this, implemented this change it works like a charm! :)

And a way to do exactly the same on category pages, if you can help me with that too? :)

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
No problem.  ;)


To add a table in search too, you need to do the following:

First, copy this code into a new file and call it "search_table.php". Warning: Name must be same as the one in the code to prevent fatal error!

Then open search.php and search2.php and replace the following code (around line 196):

Code: [Select]
<?php require(osc_search_show_as() == 'list' 'search_list.php' 'search_gallery.php'); ?>

With:

Code: [Select]
<?php //require(osc_search_show_as() == 'list' ? 'search_list.php' : 'search_gallery.php'); ?>
<?php require('search_table.php'); ?>

Notice: This will disable default gallery and list views and the buttons to change them won't work. Also, the code is only for normal ads, I left it to default for premium ads but it's easy to do it for them too.

Regards.

Screenshot:


jerico

  • Newbie
  • *
  • Posts: 12
Works perfectly, again: big , big thanks to you! :)


WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
No problem! :) Please add SOLVED to the title of this topic.

Regards.

jerico

  • Newbie
  • *
  • Posts: 12
Done, I mean added "solved" in topic title :)

Once again big thanks, and can I "use" you since you are obviously class guru? :)

For example, I have a file (some_file.php) that do some jobs, but it is a custom file, how to use sessions (already established when user login to my class site) ? I tried with "session_start()" but nothing happens, I see session vars in class pages using :

echo '<pre>';
var_dump($_SESSION);
echo '</pre>';

But I can't access them from my "custom" file, do you know maybe how to solve this Patrick?

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Well, I never tried to do something like that, but I guess you should include oc-load.php file to use osclass related functions and session.

Regards.

jerico

  • Newbie
  • *
  • Posts: 12
Patrick thanks do much again for saving a lot of time to me !:)

You gave me a right "clue" :) In case that somebody need, here is piece of code that need to be copy/pasted into page, works perfectly:



    define('ABS_PATH', str_replace('\\', '/', dirname($_SERVER['SCRIPT_FILENAME']) . '/'));
    if(PHP_SAPI==='cli') {
        define('CLI', true);
    }

    require_once ABS_PATH . 'oc-load.php';

    if( CLI ) {
        $cli_params = getopt('p:t:');
        Params::setParam('page', $cli_params['p']);
        Params::setParam('cron-type', $cli_params['t']);
        if(Params::getParam('page')=='upgrade') {
            require_once(osc_lib_path() . 'osclass/upgrade-funcs.php');
            exit(1);
        } else if( !in_array(Params::getParam('page'), array('cron')) && !in_array(Params::getParam('cron-type'), array('hourly', 'daily', 'weekly')) ) {
            exit(1);
        }
    }

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
No problem. :)

Regards.

(I'm such a spammer with this "No problem." :P)