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 6733893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:49:28+00:00 2026-05-26T10:49:28+00:00

This is a multi part question. Background: I’m building my first site using CakePHP,

  • 0

This is a multi part question.

Background:

I’m building my first site using CakePHP, and I like it so far. I’ve got a DB setup, initial data loaded, and a few models, views, and controllers to interface with the data.

I’ve created a globally accessible function to create Add/Edit/Delete type image links in various areas. It will be used across multiple views, so I need it accessible, essentially, everywhere. The function is defined in /app/config/bootstrap.php. I was hoping to use the HTML Helper’s $html->image() and $html->link() methods to facilitate this, but they’re not available in bootstrap.php and I’m not sure how to load/access the HTML Helper where I’ve defined my function.

Questions:

1) Is this a reasonable/idiomatic place to define a function of this sort?

2) If this isn’t the correct place to define the function, where should I define it?

3) If this is the correct place to define the function, how can I go about loading various CakePHP helpers?

Again, I am new to CakePHP, so please let me know if my question is unclear, and forgive my ignorance. I’ve read/searched through a fair amount of the CakePHP documentation and while I can find plenty of references to loading helpers within Controllers via App::import(...); or $helpers = array(...);, I do not seem to have access to the App object and the $helpers member is specific to the AppController class, I assume. I assume I’m going about this incorrectly, so please help me understand the Cake way of accomplishing this.

  • 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-05-26T10:49:29+00:00Added an answer on May 26, 2026 at 10:49 am

    No, that is not the correct place for such a function (or more accurately, it goes against the MVC paradigm). A better approach would be to create your own helper for the function. Depending on the complexity of the links you could also use elements.

    As a rule of thumb only functions that are completely independent of anything else in the app should be in bootstrap.php, and even most of those would often be better somewhere else.

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

Sidebar

Related Questions

This is probably a multi-part question. Background: we have a native (c++) library that
I think this is a multi-part question, so bear with me. Currently all of
This question would probably apply equally as well to other languages with C-like multi-line
This is a multi-part question. I have a table similar to: CREATE TABLE sales_data
Reading through this question on multi-threaded javascript, I was wondering if there would be
First of all, I apologize if this is a stupid question, I'm a dead
I have a multi part question for a php script file. I am creating
I have a multi-part question: (1) Is there a good reason why Silverlight doesn't
Not being experienced in multi-threaded programming or technologies, I would like to ask this
This sounds like a stupid question but, after uploading a file the file isnt

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.