I have a website that has links which, if clicked, should open a new tab and load that particular website.
I've tried using this example:
<?php echo $this->Html->link('CakeBook', 'http://cakephp.org', array('class'=> 'myclass', 'target'=>'_blank')); ?>
The problem is it isn't even clickable. I'm using CakePHP 2.5.5
Related
I have a login system maded with AngularJS. Now I want that if somebody is not logged in the template is blank. If somebody logs in the template will continue. The problem is that when you load the page the templates loads also. So when you log in you get a blank page, you need the reload the page and then its working.
Is there a function that refresh the template? So that you don`t have to reload the page?
When you use Angular it's best to have the web server serve static content (images, css, js, and static html) and data (almost always JSON).
In your case I would always serve the template and use ng-show and/or ng-hide to toggle the template display. Here's a simple example:
Instead of
<?php
echo "Hello " + $name;
?>
Do this
greeting.html
<div ng-show="authenticated">{{name}}</div>
greeting.json web service (I'm not a php person, my php might not be entirely correct):
<?php
json_encode($name)
?>
I am using ajax via js helper in my cakephp application;
for this I am using following code.
echo $this->Js->link('test','/controller/test/', array('before'=>$this->Js->get('#loading')->effect('fadeIn'),'success'=>$this->Js->get('#loading')->effect('fadeOut'),'update'=>'#mydiv'));
It is working fine.
But when I am using this code on view page,which is rendered by ajax, it i not working.
when i check the page source i found that script for this view is not added in the buffered script.
I guess buffered script is created when the page is load.In my case when page is loaded specific content is not loaded so script for this layout is not added in the buffered script.
Please guide me is there any other method by which i can do this or i have to do it by custom jquery or another method.
You should use evalScripts option in your Ajax Link. Here is the code:
echo $this->Js->link('test','/controller/test/', array('before'=>$this->Js->get('#loading')->effect('fadeIn'),'success'=>$this->Js->get('#loading')->effect('fadeOut'),'update'=>'#mydiv', 'evalScripts' => true));
And at the bottom of your Ajax view file. Be sure to include:
<?php echo $this->Js->writeBuffer();?>
I've just started with CakePHP and am having a problem withe the concept of plugins and components.
The main issue is how to include their views in my own app. For example, on the cakephp site, there is a tutorial for plugins, but they never mention how to include it in the output of my own app.
I want to create a login bar that appears on every page of my site. You know, something that either says Username Password or Welcome Fred Flintstone at the top of every page.
It seems a plug-in would be best for this as it could be included in every controller I created. But, as I mentioned, I have no idea how to include the plugin view with my app views.
lee
In this case, you would create an element:
/app/View/Elements/login_bar.ctp
echo $this->Form->create('User');
echo $this->Form->inputs(array('username', 'password'));
echo $this->Form->end('login');
and include it in your views (or layout) with:
echo $this->Element('login_bar');
See: http://book.cakephp.org/2.0/en/views.html#elements
I have been asked to add a blog for a website built in Drupal 7. I activated the blog module and made a couple entries.
The postings show up fine on the blog page, but when I click through to a single entry it is just the text of the post. I would like to add the title to the page.
How is this possible?
Thanks,
Either you have the title removed in page.tpl.php or you have a page--blog.tpl.php that has the title removed.
Copy your page.tpl.php and rename it to page--blog.tpl.php (note there are two dashes between page and blog it will not work with just one) and add in this snippet of PHP:
<h1 id="page-title"><?php print $title ?></h1>
Then clear Drupal's cache. If this does not work out for you try adding it to node--blog.tpl.php.
Has anyone successfully been able to do this?
I want MediaWiki and PHPBB to have the same header and footer as my website (default.ctp)
So instead of
<?php echo $content_for_layout; ?>
I would want to echo PHPBB or MediaWiki.
If you have a code example please paste here,
many thanks
Integrating PhpBB or Mediawiki with Cake will not be a quick job. The easiest thing to do is to install those applications separately and load them in an iframe.