Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8997517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:54:00+00:00 2026-06-15T23:54:00+00:00

Hi all I have a ‘profiles’ table and I need to make this available

  • 0

Hi all I have a ‘profiles’ table and I need to make this available in my default.ctp view file as I am trying to load profile images. I currently use the $current_user to access the ‘users’ in the form $current_user[‘filename’]. My user and profile relationships have been set in my models accordingly. If anyone could help I would appreciate it. Thanks in advance.

My AppController’s beforeFilter declaration attempt:

$this->set('profile', $this->loadModel('Profile'));
$this->set('profile', $this->User->find('all'));

My default.ctp view file code attempt:

<?php echo $this->Html->image('/uploads/profile/filename/thumb/small/'.$profile['filename']); ?>

Current code:

<?php echo $this->Html->image('/uploads/profile/filename/thumb/small/'.$current_user['filename']); ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:54:01+00:00Added an answer on June 15, 2026 at 11:54 pm

    You should clarify your requirements. If you want all profiles information on every page, then this is what you need:

    public function beforeFilter() {
       $this->loadModel('Profile');
       $profiles = $this->Profile->find('all');
       $this->set('profiles', $profiles);
    }
    
    
    // any view:
    foreach($profiles as $profile) : // e.g.
        echo $profile['Profile']['filename'];
    endforeach;
    

    but you should specify exactly what data you want to return (id, filename), as otherwise you will be returning huge amounts of data on each request, which will kill performance at any real level.

    You should cache this query and the result as it will likely not change very often.

    Edit: consider whether to use beforeFilter or beforeRender, depending on your needs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been all over this one, and I am just plumb stuck. I
I have been at this all day and I just can't figure out how
I have some ListView and I want that they all have the same View
You should all have noticed if you right click a file in the windows
First of all have a look at the following code (in this code shape
I have multiple enum's that all have the same constructor and attributes, like this:
I have a table where the cells all have a 1px top-border, except the
I have a view with several buttons that all have the same target and
I have strings that all have different lengths. e.g. str1 = This is new
I have about 8 entities that all have a one to one relationship with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.