Advertisement:

Author Topic: how to display list of company ?  (Read 3552 times)

achkarov

  • Newbie
  • *
  • Posts: 2
how to display list of company ?
« on: March 22, 2014, 03:58:08 pm »
I want to display the users in a single page in the fields of type user is company

vanmicky

  • Full Member
  • ***
  • Posts: 138
Re: how to display list of company ?
« Reply #1 on: April 04, 2014, 02:51:18 pm »
1) Create a new page from admin panel. name it "company-list.php" without the quotes.  Give a title  'List of Companies' and click show in footer so as you get the link of the page.

2)In your theme folder, add page-company-list.php.

3)then paste

Code: [Select]
<?php $user User::newInstance()->listAll(); ?>

<?php if (osc_total_users()>0) { ?>
   
<table style="width:300px">
<tr>
  <th>Username</th>
  <th>Phone Mobile</th>
  <th>Location</th>
  <th>Date registered</th>
</tr>
<?php foreach ($user as $u) { ?>

<?php  if($u["b_company"]==1) {?>
<tr>
  <th> <?php echo $u['s_username']; ?> </th>
  <th> <?php echo $u['s_phone_mobile'] ;?> </th>
  <th> <?php echo $u['s_country'] ;?> </th>
  <th> <?php echo $u['dt_reg_date'] ;?> </th>
</tr>
<?php ?>

<?php ?>
</table>

<?php ?>


Go on your footer click 'List of Companies' and you will get the list of companies. That's it.  ;)

volunteer

  • Full Member
  • ***
  • Posts: 241
Re: how to display list of company ?
« Reply #2 on: April 09, 2014, 11:32:38 pm »
I can't add PHP code to pages created by admin panel. only HTML  ???

vanmicky

  • Full Member
  • ***
  • Posts: 138
Re: how to display list of company ?
« Reply #3 on: April 10, 2014, 08:19:15 pm »
of course you can, it is easy. Follow just the following steps.

1) Create a new page from admin panel. name it "company-list.php" without the quotes.  Give a title  and click show in footer so that you get the link of the page.

2)In your theme folder, create a php file  and name it just like this, page-company-list.php.

3)Then copy the code in the page-company-list.php. (the link (url) of the page is given in footer).


BC-TEAM

  • Sr. Member
  • ****
  • Posts: 376
  • Outstanding Expert of Online Marketplaces
Re: how to display list of company ?
« Reply #4 on: April 10, 2014, 08:52:44 pm »
1) Create a new page from admin panel. name it "company-list.php" without the quotes.  Give a title  'List of Companies' and click show in footer so as you get the link of the page.

2)In your theme folder, add page-company-list.php.

3)then paste

Code: [Select]
<?php $user User::newInstance()->listAll(); ?>

<?php if (osc_total_users()>0) { ?>
   
<table style="width:300px">
<tr>
  <th>Username</th>
  <th>Phone Mobile</th>
  <th>Location</th>
  <th>Date registered</th>
</tr>
<?php foreach ($user as $u) { ?>

<?php  if($u["b_company"]==1) {?>
<tr>
  <th> <?php echo $u['s_username']; ?> </th>
  <th> <?php echo $u['s_phone_mobile'] ;?> </th>
  <th> <?php echo $u['s_country'] ;?> </th>
  <th> <?php echo $u['dt_reg_date'] ;?> </th>
</tr>
<?php ?>

<?php ?>
</table>

<?php ?>


Go on your footer click 'List of Companies' and you will get the list of companies. That's it.  ;)


I think it would be more interesting if the listed company names would redirect you onto their profile and I would use their normal name instead of username something like this:

Code: [Select]
<?php $user User::newInstance()->listAll(); ?>
<?php if (osc_total_users()>0) { ?>
    <table style="width:300px">
        <tr>
            <th>Company Name</th>
            <th>Phone Mobile</th>
            <th>Location</th>
            <th>Date registered</th>
        </tr>
        <?php foreach ($user as $u) { ?>
            <?php  if($u["b_company"]==1) {?>
                <tr>
                    <th>
                        <a href="<?php echo osc_base_url(true).'?page=user&action=pub_profile&id='.$u['pk_i_id']; ?>" >
                            <?php echo $u['s_name']; ?>
                        </a>
                    </th>
                    <th><?php echo $u['s_phone_mobile'] ;?></th>
                    <th><?php echo $u['s_country'] ;?></th>
                    <th><?php echo $u['dt_reg_date'] ;?></th>
                </tr>
            <?php ?>
        <?php ?>
    </table>
<?php ?>
[code]

 

Good shot micky  ;)

volunteer

  • Full Member
  • ***
  • Posts: 241
Re: how to display list of company ?
« Reply #5 on: April 10, 2014, 10:06:04 pm »
I follow the step given by vanmickey to create the page from admin panel

page.php   (Internal name doesnt accept that name format and it changes to page-php)

then I upload a php file (called page.php or page-php.php) to my theme folder by ftp

it doesn't work  :(

BC-TEAM

  • Sr. Member
  • ****
  • Posts: 376
  • Outstanding Expert of Online Marketplaces
Re: how to display list of company ?
« Reply #6 on: April 10, 2014, 10:17:44 pm »
I follow the step given by vanmickey to create the page from admin panel

page.php   (Internal name doesnt accept that name format and it changes to page-php)

then I upload a php file (called page.php or page-php.php) to my theme folder by ftp

it doesn't work  :(


Because vanmicky was a bit wrong :)

1, Go to: Admin panel » Pages » Add new
2, - Title: List of Companies (or whatever you want)
    - Internal name: company-list (without .php!!!)
3, Then open your html editor (dreamweaver, coffeecup and so on..) and paste the codes below. (Strongly recommended to use head; header; footer etc [your contents])  :)
    And save the file as name as page-company-list.php

Finally upload the new file and that's it.

Max
« Last Edit: April 10, 2014, 10:20:04 pm by Max (MYOS) »

BC-TEAM

  • Sr. Member
  • ****
  • Posts: 376
  • Outstanding Expert of Online Marketplaces
Re: how to display list of company ?
« Reply #7 on: April 10, 2014, 10:18:32 pm »
.

Dare

  • Newbie
  • *
  • Posts: 27
Re: how to display list of company ?
« Reply #8 on: October 23, 2014, 03:55:47 pm »
How can create such boxing ?

bengalliboy

  • Full Member
  • ***
  • Posts: 204
Re: how to display list of company ?
« Reply #9 on: October 24, 2014, 05:11:06 pm »
I have a company page that was created. Take a look here:
http://khanslist.com/index.php?page=companies

Dare

  • Newbie
  • *
  • Posts: 27
Re: how to display list of company ?
« Reply #10 on: October 25, 2014, 07:35:22 pm »
Great,I have a problem withimage display, here's my code,
Code: [Select]
<div class="col-marketing">
   
<?php $user User::newInstance()->listAll(); ?>
<?php if (osc_total_users()>0) { ?>
    <table border="1" style="width:100%">
        <tr style="border:thin; border-color:#999; background-color:#CCC;">
            <th>User</th>
            <th>Phone</th>
            <th>Location</th>
            <th>Register</th>
        </tr>
        <?php foreach ($user as $u) { ?>
            <?php  if($u["b_company"]==1) {?>
         
                <tr>
                    <th>
                    <?php echo '<img src="'.osc_base_url(true) . 'oc-content/plugins/profile_picture/images/profile'.$user['pk_i_id'].".jpg".".png".".gif".'"  .width="150px". height="150px" />' ' <a href="user/profile/'.$user['pk_i_id'].'">'$user['s_name'].'</a>' '<br /> ';?>
                        <a href="<?php echo osc_base_url(true) . '?page=user&action=pub_profile&id='.$u['pk_i_id']; ?>" >
                            <?php echo $u['s_name']; ?>
                        </a>
                    </th>
                    <th><?php echo $u['s_phone_mobile'] ;?></th>
                    <th><?php echo $u['s_country'] ;?></th>
                    <th><?php echo $u['dt_reg_date'] ;?></th>
                </tr>
            <?php ?>
        <?php ?>
    </table>
<?php ?>

</div>

Could you put your code to compare?
« Last Edit: October 25, 2014, 07:37:56 pm by Dare »

rahulk

  • Full Member
  • ***
  • Posts: 132
  • What we face is destiny, how we face is free will.
Re: how to display list of company ?
« Reply #11 on: October 26, 2014, 09:14:23 am »
Hi

On company page, I want search bar to search companies by city and category with paging.

can someone help?

Thanks.

itcafeonline

  • Full Member
  • ***
  • Posts: 245
Re: how to display list of company ?
« Reply #12 on: November 01, 2014, 07:45:02 am »
+ 1