Code Monkey home page Code Monkey logo

Comments (6)

dongilbert avatar dongilbert commented on August 16, 2024

You're approaching if with the right idea, but your implementation is slightly off. Where is are you running this code? In your com_jehuti/jehuti.php file? If so, your call should be registerPrefix('Jehuti', DIR);

Then, when using a class, it will look for JehutiModel in com_jehuti/model/model.php and JehutiModelBase in com_jehuti/model/base.php

However, you must note, that if your building this in the CMS as a component, you'll have issues withe the default configuration. I can send you a screenshot of my directory structure if you'd like later when I'm on my computer.

Sent from my iPhone

On Jan 17, 2013, at 1:20 AM, "Nestor E. Ledon" [email protected] wrote:

Using the version of J! Platform that comes with the latest version of J! CMS, auto loading using registerPrefix or discover don't seem to work.

The below does squat, my files and class names follow convention:
JLoader::registerPrefix('Jehuti', JPATH_PLATFORM . '/../components/com_jehuti/controllers/');
JLoader::discover('Jehuti', JPATH_PLATFORM . '/../components/com_jehuti/controllers/');

However if I load individual files, works fine:
Loader::register('JehutiController', JPATH_PLATFORM . '/../components/com_jehuti/controllers/jehuti.php', true);
JLoader::register('JehutiModel', JPATH_PLATFORM . '/../components/com_jehuti/models/jehuti.php', true);
JLoader::register('JehutiView', JPATH_PLATFORM . '/../components/com_jehuti/views/jehuti.php', true);


Reply to this email directly or view it on GitHub.

from joomla-platform.

Xerosigma avatar Xerosigma commented on August 16, 2024

Thanks, I would really appreciate a if you could send me a diagram or
screen shot of a working structure for CMS.
Currently this is mine:
[image: Inline image 1]

I'm running the code from the highlighted file: com_jehuti/site/jehuti.php
I'm assuming this is wrong?

On Thu, Jan 17, 2013 at 1:33 AM, Don Gilbert [email protected]:

You're approaching if with the right idea, but your implementation is
slightly off. Where is are you running this code? In your
com_jehuti/jehuti.php file? If so, your call should be
registerPrefix('Jehuti', DIR);

Then, when using a class, it will look for JehutiModel in
com_jehuti/model/model.php and JehutiModelBase in com_jehuti/model/base.php

However, you must note, that if your building this in the CMS as a
component, you'll have issues withe the default configuration. I can send
you a screenshot of my directory structure if you'd like later when I'm on
my computer.

Sent from my iPhone

On Jan 17, 2013, at 1:20 AM, "Nestor E. Ledon" [email protected]
wrote:

Using the version of J! Platform that comes with the latest version of
J! CMS, auto loading using registerPrefix or discover don't seem to work.

The below does squat, my files and class names follow convention:
JLoader::registerPrefix('Jehuti', JPATH_PLATFORM .
'/../components/com_jehuti/controllers/');
JLoader::discover('Jehuti', JPATH_PLATFORM .
'/../components/com_jehuti/controllers/');

However if I load individual files, works fine:
Loader::register('JehutiController', JPATH_PLATFORM .
'/../components/com_jehuti/controllers/jehuti.php', true);
JLoader::register('JehutiModel', JPATH_PLATFORM .
'/../components/com_jehuti/models/jehuti.php', true);
JLoader::register('JehutiView', JPATH_PLATFORM .
'/../components/com_jehuti/views/jehuti.php', true);


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1804#issuecomment-12357403.

Nestor Ledon

CEO | Terra Chaos Corporation | www.terrachaos.com http://terrachaos.com

from joomla-platform.

dongilbert avatar dongilbert commented on August 16, 2024

Here's a basic structure: http://d.pr/i/5qF7

And here's my components bootstrap file: http://d.pr/i/FX4

I'm going to write up a blog post about it eventually. Not sure when I'll
have time though. Hope it helps.

On Thu, Jan 17, 2013 at 9:57 AM, Nestor E. Ledon
[email protected]:

Thanks, I would really appreciate a if you could send me a diagram or
screen shot of a working structure for CMS.
Currently this is mine:
[image: Inline image 1]

I'm running the code from the highlighted file:
com_jehuti/site/jehuti.php
I'm assuming this is wrong?

On Thu, Jan 17, 2013 at 1:33 AM, Don Gilbert [email protected]:

You're approaching if with the right idea, but your implementation is
slightly off. Where is are you running this code? In your
com_jehuti/jehuti.php file? If so, your call should be
registerPrefix('Jehuti', DIR);

Then, when using a class, it will look for JehutiModel in
com_jehuti/model/model.php and JehutiModelBase in
com_jehuti/model/base.php

However, you must note, that if your building this in the CMS as a
component, you'll have issues withe the default configuration. I can
send
you a screenshot of my directory structure if you'd like later when I'm
on
my computer.

Sent from my iPhone

On Jan 17, 2013, at 1:20 AM, "Nestor E. Ledon" [email protected]

wrote:

Using the version of J! Platform that comes with the latest version of
J! CMS, auto loading using registerPrefix or discover don't seem to
work.

The below does squat, my files and class names follow convention:
JLoader::registerPrefix('Jehuti', JPATH_PLATFORM .
'/../components/com_jehuti/controllers/');
JLoader::discover('Jehuti', JPATH_PLATFORM .
'/../components/com_jehuti/controllers/');

However if I load individual files, works fine:
Loader::register('JehutiController', JPATH_PLATFORM .
'/../components/com_jehuti/controllers/jehuti.php', true);
JLoader::register('JehutiModel', JPATH_PLATFORM .
'/../components/com_jehuti/models/jehuti.php', true);
JLoader::register('JehutiView', JPATH_PLATFORM .
'/../components/com_jehuti/views/jehuti.php', true);


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub<
https://github.com/joomla/joomla-platform/issues/1804#issuecomment-12357403>.

Nestor Ledon

CEO | Terra Chaos Corporation | www.terrachaos.com http://terrachaos.com


Reply to this email directly or view it on GitHubhttps://github.com//issues/1804#issuecomment-12374031.

from joomla-platform.

Xerosigma avatar Xerosigma commented on August 16, 2024

Thanks a ton. If I'm not mistaken though,my deployed structure is the same as yours. I'll review your bootstrap maybe I'm missing something.

app-struc

Thanks again for the response.

from joomla-platform.

dongilbert avatar dongilbert commented on August 16, 2024

The main difference is, if you register a prefix, it follows a pattern when
trying to autoload the file.

So I have registerPrefix('RV', DIR). When I try to use RvModelResort,
it looks for it in DIR . '/model/resort.php';

Have a look at the JLoader documentation here:
http://joomla.github.com/joomla-platform/

On Thu, Jan 17, 2013 at 12:56 PM, Nestor E. Ledon
[email protected]:

Thanks a ton. If I'm not mistaken though,my structure is the same as
yours. I'll review your bootstrap maybe I'm missing something.

[image: app-struc]https://f.cloud.github.com/assets/2592281/75817/7739faec-60d7-11e2-90e1-db99585cb77c.png

Thanks again for the response.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1804#issuecomment-12383033.

from joomla-platform.

Xerosigma avatar Xerosigma commented on August 16, 2024

Oh dear... I have it working. My directories where not named correctly. I had "controllers" instead of "controller."

Thanks a ton for the help.

from joomla-platform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.