Advertisement:

Author Topic: Mobile app using feeds  (Read 2792 times)

BuySellAndSwap

  • Sr. Member
  • ****
  • Posts: 389
Mobile app using feeds
« on: October 13, 2011, 01:30:48 am »
I have created a mobile app using http://mobile.conduit.com/How-to-Create-Mobile-Apps.aspx if anyone is intrested see it at http://classifieds.mobapp.at is allows people to veiw your facebook, twitter, rss feeds on there mobile and link to your site...

Only thing is there a way for me to not show the side bar on the main.php page on bcute theme when been visited on a mobile of make the site more mobile friendly?

Thank you

Juan Ramón

  • Osclass Developer
  • Hero Member
  • *****
  • Posts: 2382
Re: Mobile app using feeds
« Reply #1 on: October 13, 2011, 03:10:41 pm »
Wow, nice job! I didn't know about this service of conduit.

You should modify the bcute theme and check if the User Agent in order to know if the user comes from a mobile or not.

BuySellAndSwap

  • Sr. Member
  • ****
  • Posts: 389
Re: Mobile app using feeds
« Reply #2 on: October 14, 2011, 01:36:29 am »
Please could you give me a bit more detail how to do that please?

Thank you

Juan Ramón

  • Osclass Developer
  • Hero Member
  • *****
  • Posts: 2382
Re: Mobile app using feeds
« Reply #3 on: October 14, 2011, 02:15:45 pm »
You can take a look into this code: https://github.com/osclass/osclass-plugins/blob/osc-mobile/osc_mobile/index.php

Using the UserAgentClass.php and user_agents.php you can get with the next code if the user agent is from a mobile platform or not:


$userAgent 
= new UserAgent() ;
$userAgent->is_mobile() ; // return boolean: true if it's mobile and false if it is not

BuySellAndSwap

  • Sr. Member
  • ****
  • Posts: 389
Re: Mobile app using feeds
« Reply #4 on: October 15, 2011, 12:43:55 am »
Sorry it may sound stupid but how do i implement this into my site please?

Thank you

Juan Ramón

  • Osclass Developer
  • Hero Member
  • *****
  • Posts: 2382
Re: Mobile app using feeds
« Reply #5 on: October 18, 2011, 02:16:40 pm »
You should create a folder named useragent in your theme and copy inside this two files:
    - https://github.com/osclass/osclass-plugins/blob/osc-mobile/osc_mobile/UserAgentClass.php
    - https://github.com/osclass/osclass-plugins/blob/osc-mobile/osc_mobile/user_agents.php

Then, you should add this code in the functions.php file:

    require_once dirname__FILE__ ) . '/useragent/UserAgentClass.php' ;

Then in the main.php of the theme in the header you should initialize the class:
     $userAgent = new UserAgent() ; 

And wherever you want to check if they are using a mobile or not, use this:
   
    
if( $userAgent->is_mobile() ; ) {
         
// it is a mobile
    
} else {
        
// it is not a mobile
    

BuySellAndSwap

  • Sr. Member
  • ****
  • Posts: 389
Re: Mobile app using feeds
« Reply #6 on: October 18, 2011, 05:15:33 pm »
Quote
Then in the main.php of the theme in the header you should initialize the class:
   
 $userAgent = new UserAgent() ;

And wherever you want to check if they are using a mobile or not, use this:
   
    if( $userAgent->is_mobile() ; ) {
         // it is a mobile
    } else {
        // it is not a mobile

I placed
Code: [Select]
$userAgent = new UserAgent() ; into main.php in the head section but it just shown as text on the page

Sorry to keep asking for help but how do i implement the last part please?

Thank you

Juan Ramón

  • Osclass Developer
  • Hero Member
  • *****
  • Posts: 2382
Re: Mobile app using feeds
« Reply #7 on: October 18, 2011, 05:31:07 pm »
You should use this code inside php tags: <?php //code ?>