Sunday, December 30, 2012

Re: Not able to view anything on the page

If you want /blog as your default (index) page (http://localhost) you can set it in config/routes.php.

-> Router::connect('/', array('controller' => 'blogs', 'action' => 'index'));


On Sunday, December 30, 2012 1:20:13 AM UTC+1, Harish Geeth wrote:
Hi,

I am new to cakePHP and downloaded the framework and started playing with it. I am using NetBeans to edit PHP files. I am able to cinfigure the CakePHP as expected. I get successful messages when I try to hit the webserver. But for some reason when I try to run the application after adding Model and Controller, I don't see the results as exected.


 
Folder structure is 


CONTROLLER

<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of blog_controller
 *
 * @author harishupadhyayula
 */
class BlogsController extends AppController {
    
    var $name = 'Blog';
    var $uses = array('Blog');
    
    
    var $scaffold;
}

?>

MODEL

<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of blog
 *
 * @author harishupadhyayula
 */
class Blog extends AppModel {
    var $name = 'Blog';
}

?>
I modified my dabase.php files as well. I am not sure where it's going wrong and I tried all day to figure this out but i had not luck.

Any help is appreciated.


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Saturday, December 29, 2012

Re: Not able to view anything on the page

In order to see the blog controller pages you need to go to /blog

On Dec 29, 2012 7:03 PM, "Harish Geeth" <harish.upad@gmail.com> wrote:
Hi,

I am new to cakePHP and downloaded the framework and started playing with it. I am using NetBeans to edit PHP files. I am able to cinfigure the CakePHP as expected. I get successful messages when I try to hit the webserver. But for some reason when I try to run the application after adding Model and Controller, I don't see the results as exected.


 
Folder structure is 


CONTROLLER

<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of blog_controller
 *
 * @author harishupadhyayula
 */
class BlogsController extends AppController {
    
    var $name = 'Blog';
    var $uses = array('Blog');
    
    
    var $scaffold;
}

?>

MODEL

<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of blog
 *
 * @author harishupadhyayula
 */
class Blog extends AppModel {
    var $name = 'Blog';
}

?>
I modified my dabase.php files as well. I am not sure where it's going wrong and I tried all day to figure this out but i had not luck.

Any help is appreciated.


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Not able to view anything on the page

Hi,

I am new to cakePHP and downloaded the framework and started playing with it. I am using NetBeans to edit PHP files. I am able to cinfigure the CakePHP as expected. I get successful messages when I try to hit the webserver. But for some reason when I try to run the application after adding Model and Controller, I don't see the results as exected.


 
Folder structure is 


CONTROLLER

<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of blog_controller
 *
 * @author harishupadhyayula
 */
class BlogsController extends AppController {
    
    var $name = 'Blog';
    var $uses = array('Blog');
    
    
    var $scaffold;
}

?>

MODEL

<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of blog
 *
 * @author harishupadhyayula
 */
class Blog extends AppModel {
    var $name = 'Blog';
}

?>
I modified my dabase.php files as well. I am not sure where it's going wrong and I tried all day to figure this out but i had not luck.

Any help is appreciated.


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

RE: Dealing with Image Uploads

Thanks, I have it working to a point.
Images get uploaded and associated correct but my model field is always
empty

Image Model:

public $belongsTo = array(
'Product' => array(
'className' => 'Product',
'foreignKey' => 'id',
'conditions' => array(
'Image.model' => 'Product'),
'dependant' => true
)
);

Product Model:
public $hasMany = array(
'Image' => array(
'className' => 'Image',
'foreignKey' => 'foreign_key',
'dependent' => true));

Do I need to add something to the Product Model relation?
Or I manually have to add in the $this->request-data['Image']['model'] =
'Product'; before the save?

Thanks again,

Dave

-----Original Message-----
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of lowpass
Sent: Friday, December 28, 2012 3:17 PM
To: cake-php@googlegroups.com
Subject: Re: Dealing with Image Uploads

One approach is to add foreign_key and model columns to your images table so
you can create associations between Image and other models like this:

public $belongsTo = array(
'Publication' => array(
'className' => 'Publication',
'foreignKey' => 'foreign_key',
'conditions' => array(
'Image.model' => 'Publication'
),
'dependent' => true
),
'Author' => array(
'className' => 'Author',
'foreignKey' => 'foreign_key',
'conditions' => array(
'Image.model' => 'Author'
),
'dependent' => true
)
);

You can then store settings for the various models within the Image class:

public $settings = array(
'Publication' => array(
'directory' => 'img/publications',
'width' => 220,
'height' => 288,
'wp' => 220,
'hp' => 288,
'wl' => 220,
'hl' => 288
),
...
);

Then create an ImageComponent to handle the upload and resize, accessing the
required settings much the same way that a behavior reads its own settings
for a given model. That is,
$this->__Controller->{$model}->Image->settings[$model]['width'], or
something similar. Of course, you'll need to pass the desired model somehow,
either in the upload form or as a parameter passed from the controller to
the component.

For Thumbnails, create a separate table and associate them by image_id. The
class itself can also have a $settings array similar to that in Image, so
that you can have various sizes of thumb.

On Fri, Dec 28, 2012 at 12:44 AM, Advantage+ <movepixels@gmail.com> wrote:
> I need to figure out the best way from the backed the admin can upload
> images, the tricky part is the site has all different kinds of images
> (small product thumbs, large version, they want to be able to upload
> images into the jquery slider on the home page, images for a new
> sections, featured product on index page to name a few of the
> different sizes)
>
>
>
> And there is no way to know if they are even going to upload the right
> dimensions for each type of image.
>
>
>
> What is the best way to do this? I cannot seem to think of anything
> having a table for each_image how it relates to that page, that seems
> like the opposite of what should be done.
>
>
>
> Any idea would be great.
>
>
>
> Thanks, Dave
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP Find us on
> Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google
> Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter
http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.



--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.

Submit separably triggered form parts at once

Hi

I'm using PHP to create forms for user to fill up. part of the form is not for everyone, so users who want to fill it up has to click on a box below the form to trigger new fields. I'm using Ajax for triggering the hidden part of the forms. Ajax will make a new part of the form apear in the page without having to refresh. 

The problem is that when I trigger several of the hidden parts I can submit them all to the data base at once. each of them was triggered at a different time and it has its own save button. 

How can I save them at once. 


"Proprofs" quiz making site is a good example. user can add different type of questions as he goes in making a quize the different questions for will appear on the page then will be submitted at once. 





Ajax code.
function handleChange(cb) {

//get the selected value 
var value = cb.value;
var divNum = cb.value;

//status variable for validation 
var status;
(cb.value == 0 )?status ='new': status =2; 

alert (cb.value); 

//set image back to delete and undo deletion 
if (cb.name =='undo')
status='delete'; 

if (cb.value==0)


//check if browser suports ajax
var xmlhttp = null; 
if(typeof XMLHttpRequest != 'udefined'){
xmlhttp = new XMLHttpRequest();
}

else if(typeof ActiveXObject != 'undefined'){
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}

else 
throw new Error('You browser doesn\'t support ajax');
//open connection with activateImages.php to recieve the active images as an acho
xmlhttp.open("GET", "ManageQuestionsImages.php?status="+status + "&id="+value,true); 


if (status !='new'){
//check if ready to recieve 
xmlhttp.onreadystatechange = function (){

if(xmlhttp.readyState == 4) 
window.activate(xmlhttp,divNum);
};
xmlhttp.send(null);
}

else {
//check if ready to recieve for add new template form 
xmlhttp.onreadystatechange = function (){
if(xmlhttp.readyState == 4)
window.activated(xmlhttp);
};
xmlhttp.send(null);

}
}

//recieve the active images then insert them in the specified location of the page. 
function activate(xhr,divNum){ 
if(xhr.status == 200){
document.getElementById(divNum).innerHTML = xhr.responseText;
}
else 
throw new Error('Server has encountered an error\n'+
'Error code = '+xhr.status);
};

//recieve the active form then insert it in template div. 
function activated(xhr){
if(xhr.status == 200){
document.getElementById('template').innerHTML = xhr.responseText;
}
else 
throw new Error('Server has encountered an error\n'+
'Error code = '+xhr.status);
}








--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

CAKEPHP 2.1.x on Pagodabox | foreach multiple items for each slide (bootstrap carousel)

Hi,

I'm looking for a way to show multiple 'Ads' / slide with a foreach loop from the db. ( each client has ads tied to them.)

My code now works great but only shows one ad / slide.

Thanks for your time!

Sven

Code: 
___________

<div class="carousel-inner">    
<?php foreach ($ads as $indexValue => $ad):
if($indexValue == 0){?>
<div class="item active">
<a class="adshref" href="//<?php echo $ad['Ad']['link']?>"><?php echo $ad['Ad']['title']?></a><br>
<span class="adslink"><?php echo $ad['Ad']['link']?></span><br>
<span class="adsbody"><?php echo $ad['Ad']['body']?></span><br></div><?php
} else { ?>
<div class="item">
<a class="adshref" href="//<?php echo $ad['Ad']['link']?>"><?php echo $ad['Ad']['title']?></a><br>
<span class="adslink"><?php echo $ad['Ad']['link']?></span><br>
<span class="adsbody"><?php echo $ad['Ad']['body']?></span><br></div>
<?php } endforeach; ?>  </div>

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Re: User Model changes to AppModel

Have done some troubleshooting.

If in beforeFilter(), I place $u = $this->User
In index() debug($this->User) = object(User) { ... }

However, in all cases, $this->Role has been removed

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.