ShadowCross:
Thanks... set the class up (more carefully) in the plugins/
apphp_tabs/ folder and then used the info from the link you
specified,
// If use: "/plugin_name/js/my_file.js" Then, links to: "app/
plugins/plugin_name/webroot/js/my_file.js"
// So, this now works perfectly!
echo $this->Html->css('/'. TABS_CAKE_PLUGIN_NAME . '/css/
styles/' . $this->style . '/style');
echo $this->Html->script('/'. TABS_CAKE_PLUGIN_NAME . '/js/
script');
Thank you!
On Feb 9, 8:33 am, ShadowCross <[email protected]> wrote:
> Greg:
>
> The problem is the following code in your tabs class:
>
> $this->path = 'C:/xampp/htdocs/ezShoot_v5/app/plugins/
> apphp_tabs/webroot/';
> if(file_exists($this->path."styles/common.css"))
> echo "<link href='".$this->path."styles/common.css'
> rel='stylesheet' type='text/css' />";
>
> $this->path refers to a local path that php (running on your
> webserver) can see, so the file_exists($this->path."styles/
> common.css") is fine
>
> BUT using it in an HTML tag (in your case, "link") will fail, because
> the HTML tags are interpreted by the webbrowser running on the client
> workstation (which is usually a different machine from the server).
>
> You will need to convert the local path to a valid url path, which
> does not include the name of the document root (C:/xampp/htdocs).
> Also note the difference between the url and the linked file in the
> "Linking to assets in plugins" example
> onhttp://book.cakephp.org/view/1117/Plugin-assets
>
> On Feb 8, 12:03 pm, glk <[email protected]> wrote:
>
> > Hello,
>
> > I'm trying to get a tabs class (written by a 3rd party) to work well
> > with Cake. I started out using it as an app/vendors/apphp_tabs just
> > like the tcpdf class is... but the tabs class wants to access other
> > files within the same directory structure.
>
> > I read a little more, and Cake v1.3 says that "vendors" is going
> > away... use plugins... I have the following directory structure:
> > app\plugins\apphp_tabs\webroot\
> > config\
> > docs\
> > examples\
> > inc\
> > js\
> > license\
> > styles\
> > tabs_class.php
>
> > I have the import in the one (and only) controller of interest right
> > now:
> > App::import('Plugins', 'apphp_tabs.tabs_class.php');
>
> > Inside the tabs class - used inside the view - with $tabs = new
> > Tabs(...);
> > $this->style = 'xp';
> > $this->path = 'C:/xampp/htdocs/ezShoot_v5/app/plugins/
> > apphp_tabs/webroot/';
> > if(file_exists($this->path."styles/common.css"))
> > echo "<link href='".$this->path."styles/common.css'
> > rel='stylesheet' type='text/css' />";
>
> > Even though php thinks the file exists, the href will never find it
> > since it's outside of app/webroot. FireBug always reports
> > "undefined!" So, I resorted to trying to load the css and js in the
> > view, prior to creating an instance of the Tabs Class:
>
> > define ('TABS_CSS', 'C:/xampp/htdocs/ezShoot_v5/app/
> > plugins/apphp_tabs/webroot/styles/');
> > $icss = TABS_CSS . "common.css";
> > echo $this->Html->style('<style>' .
> > file_get_contents($icss) . '</
> > style>');
>
> > and basically the same thing with ->scriptBlock() to handle the
> > javascripts. All of these are just inline since it's happening in the
> > view.
>
> > Now, the question? Isn't the idea behind the plugins and the new
> > plugins/apphp_tabs/webroot/ supposed to lead to magic for the js,
> > and css, and img? But how can the href refer to something outside of
> > webroot?
>
> > I'm a newbie, so maybe I'm missing something simple...
>
> > Thanks in advance,
> > Greg
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php