• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1249
  • Last Modified:

Cake PHP - Cannot locate functions that create content

Hi

I'm a little surprised by 2nd encounter with Cake PHP because although I can find multiple index files I cannot find the files that hold functions used in those index.php. I need to use the data echoed on the page in the pages head but I can't even figure out the functions or variables that retrieve the data. Please help if possible.

The higher directory index files do not appear to include any files. I'm going to have to paste 3 seperate index files to provide anything useful and even then I'm not sure how you can help however it may be my inexperiance and you'll spot something.

The website is...
http://www.pangaeaa.com/art_profiles/view/469

I'll post the page below that displays this page and the hire directory index which include this index.

Any advice is great.
This page is the layout page (index.ctp) Included by the page I'll display after it...............
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<!-- THIS PAGE DISPLAYS ARTIST PROFILE IN THE MUSIC SECTION Note by www.webtechglobal.co.uk -->
		<title><?php echo $title_for_layout;?></title>
 
		<?php echo $html->charset();?>
		<?php echo $html->css('style.default.css?ver=20080730');?>
		<?php echo $image->javascript(); ?>
		<?php echo $wimpy->javascript(); ?>
		<!--[if lte IE 7]>
			<style>#submenu a { padding-top: 0; }</style>
		<![endif]-->
		<link rel="shortcut icon" href="http://www.pangaeaa.com/favicon.ico" type="image/vnd.microsoft.icon" />
		<meta name="verify-v1" content="IR31IpXGEy/FuJAyrhzHPL9aO3DiFTb8xP/hyYDapns=" />
		<meta name="Description" content="Best platform for photography, painting and sculpture. Put your work here and get noticed by the world. Promote your artwork and earn.">
		<meta name="Keywords" content="musictestonly,artwork for sale,contemporary abstract art,modern artwork,art and craft supplies,original artwork,art showcase,western art,artworks,art institute online,the art institute of dallas.">
		<meta name="Robots" content="index,follow"/>
		<meta name="Author" content="http://www.pangaeaa.com"/>
	</head>
	<body id="default">
		<div id="layoutWrapper">
			<div id="layout">
				<?php echo $this->renderElement('header'); ?>
				<div id="contentWrapper">
					<div id="content">
					
						<div id="submenu">
							<?php if(isset($submenu)): ?>
								<ul>
									<?php foreach($submenu as $id => $item): ?>
										<li><?php echo $html->link('<span>'.strtolower($item).'</span>', array('controller' => 'genres', 'action' => 'view', $id), null, null, false); ?></li>
									<?php endforeach; ?>
								</ul>
							<?php else: ?>
								<p>&nbsp;</p>
							<?php endif; ?>
						</div>
						
						<div id="threeCol">
							<div id="centerColWrapperArtist">
								<div><?php echo $image->display('content.header.default.artist.gif', array('alt' => '')); ?></div>
								<div id="centerColArtist">
									<div id="centerColContent">
										<?php if($session->check('Message.flash')) $session->flash(); ?>
										<?php echo $content_for_layout;?>
									</div>
								</div>
								<div><?php echo $image->display('content.footer.default.artist.gif', array('alt' => '')); ?></div>
							</div>
							<?php if(!(isset($hideRightCol) && $hideRightCol)): ?>
								<div id="rightCol">
									<div class="rightColBox">
										<?php echo $this->renderElement('addthis'); ?>
									</div>
									<div class="rightColBox">
										<?php echo $image->display('rightcol.header.ad.jpg', array('alt' => '')); ?><!--
										--><div class="rightColContentAd" >
											<div class="rightColAd">
												<script type="text/javascript"><!--
													google_ad_client = "pub-0530903194656663";
													/* 120x240, created 3/22/08 */
													google_ad_slot = "9178077679";
													google_ad_width = 120;
													google_ad_height = 240;
													//-->
												</script>
												<script type="text/javascript"
													src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
												</script>
											</div>
										</div>
										<?php echo $image->display('rightcol.footer.ad.jpg', array('alt' => '')); ?>
									</div>
									
									<div class="rightColBox">
										<div><?php echo $image->display('rightcol.header.search.jpg', array('alt' => '')); ?></div>
										<?php echo $this->renderElement('search'); ?>
										<div><?php echo $image->display('rightcol.footer.jpg', array('alt' => '')); ?></div>
									</div>
									<?php if(!($session->check('User'))): ?>
										<div class="rightColBox">
											<div><?php echo $image->display('rightcol.header.join.jpg', array('alt' => '')); ?></div>
											<div class="rightColContent">
												Join today and become a part of the Artist revolution. It's Free!<br />
												<p class="rightColLink">
													<?php echo $image->display('orange_button_go.gif', array('alt' => 'Go', 'width' => '40'), '/users/add');?>
												</p>
											</div>
											<div><?php echo $image->display('rightcol.footer.jpg', array('alt' => '')); ?></div>
										</div>
									<?php endif; ?>
									<?php if(!(isset($hideTellAFriend) && $hideTellAFriend)){ ?>
										<div class="rightColBox">
											<div><?php echo $image->display('rightcol.header.friend.jpg', array('alt' => '')); ?></div>
											<?php echo $this->renderElement('friend'); ?>
											<div><?php echo $image->display('rightcol.footer.jpg', array('alt' => '')); ?></div>
										</div>
									<?php } ?>
									<div class="rightColBox">
										<div><?php echo $image->display('rightcol.header.feedback.jpg', array('alt' => '')); ?></div>
										<div class="rightColContent">
											Pangaeaa invites you to provide your feedback regarding the current look and feel of the website, as well as any enhancements you would like to see in the future.<br />
											<p class="rightColLink">
												<?php echo $image->display('orange_button_go.gif', array('alt' => 'Go', 'width' => '40'), '/contents/display/feedback');?>
											</p>
										</div>
										<div><?php echo $image->display('rightcol.footer.jpg', array('alt' => '')); ?></div>
									</div>
								</div>
							</div>
						<?php endif; ?>
						<div class="clearBoth">&nbsp;</div>
						<?php if($session->check('Message.flash')) $session->flash(); ?>
					</div>
				</div>
				<?php echo $this->renderElement('footer'); ?>
			</div>
		</div>
		<?php echo $cakeDebug?>
		<script type="text/javascript">
			var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
			document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
		</script>
		<script type="text/javascript">
			var pageTracker = _gat._getTracker("UA-3053011-1");
			pageTracker._initData();
			pageTracker._trackPageview();
		</script>
	</body>
</html>
 
THIS IS THE PAGE THAT INCLUDES THE ABOVE PAGE.................................................
 
<?php
/* SVN FILE: $Id: index.php 4605 2007-03-09 23:26:37Z phpnut $ */
/**
 * Short description for file.
 *
 * Long description for file
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/>
 * Copyright 2005-2007, Cake Software Foundation, Inc.
 *								1785 E. Sahara Avenue, Suite 490-204
 *								Las Vegas, Nevada 89104
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright		Copyright 2005-2007, Cake Software Foundation, Inc.
 * @link				http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
 * @package			cake
 * @subpackage		cake.app.webroot
 * @since			CakePHP(tm) v 0.2.9
 * @version			$Revision: 4605 $
 * @modifiedby		$LastChangedBy: phpnut $
 * @lastmodified	$Date: 2007-03-09 17:26:37 -0600 (Fri, 09 Mar 2007) $
 * @license			http://www.opensource.org/licenses/mit-license.php The MIT License
 */
/**
 * Do not change
 */
	if (!defined('DS')) {
		 define('DS', DIRECTORY_SEPARATOR);
	}
/**
 * These defines should only be edited if you have cake installed in
 * a directory layout other than the way it is distributed.
 * Each define has a commented line of code that explains what you would change.
 */
	if (!defined('ROOT')) {
		 //define('ROOT', 'FULL PATH TO DIRECTORY WHERE APP DIRECTORY IS LOCATED. DO NOT ADD A TRAILING DIRECTORY SEPARATOR');
		 //You should also use the DS define to separate your directories
		 define('ROOT', dirname(dirname(dirname(__FILE__))));
	}
	if (!defined('APP_DIR')) {
		 //define('APP_DIR', 'DIRECTORY NAME OF APPLICATION');
		 define('APP_DIR', basename(dirname(dirname(__FILE__))));
	}
/**
 * This only needs to be changed if the cake installed libs are located
 * outside of the distributed directory structure.
 */
	if (!defined('CAKE_CORE_INCLUDE_PATH')) {
		 //define ('CAKE_CORE_INCLUDE_PATH', 'FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED. DO NOT ADD A TRAILING DIRECTORY SEPARATOR');
		 //You should also use the DS define to separate your directories
		 define('CAKE_CORE_INCLUDE_PATH', ROOT);
	}
///////////////////////////////
//DO NOT EDIT BELOW THIS LINE//
///////////////////////////////
	if (!defined('WEBROOT_DIR')) {
		 define('WEBROOT_DIR', basename(dirname(__FILE__)));
	}
	if (!defined('WWW_ROOT')) {
		 define('WWW_ROOT', dirname(__FILE__) . DS);
	}
	if (!defined('CORE_PATH')) {
		 if (function_exists('ini_set')) {
			  ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path'));
			  define('APP_PATH', null);
			  define('CORE_PATH', null);
		 } else {
			  define('APP_PATH', ROOT . DS . APP_DIR . DS);
			  define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
		 }
	}
	if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) {
		trigger_error("Can't find CakePHP core.  Check the value of CAKE_CORE_INCLUDE_PATH in app/webroot/index.php.  It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory." , E_USER_ERROR);
	}
	if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') {
	} else {
		 $Dispatcher=new Dispatcher();
		 $Dispatcher->dispatch($url);
	}
	if (Configure::read() > 0) {
		 echo "<!-- " . round(getMicrotime() - $TIME_START, 4) . "s -->";
	}
?>
 
THE INDEX FILE IN THE HIGHEST DIRECTORY IS THIS...
 
<?php
require 'webroot' . DIRECTORY_SEPARATOR . 'index.php';
?>

Open in new window

0
Ryan Bayne
Asked:
Ryan Bayne
  • 3
  • 3
2 Solutions
 
Steve BinkCommented:
There are two include files in the code you posted.

Line 213: if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) {
Line 229: require 'webroot' . DIRECTORY_SEPARATOR . 'index.php';

It looks like 229 includes the file containing 213, so I would start with resolving CORE_PATH.'cake'.DS.'bootstrap.php'
0
 
Ryan BayneWordPress DeveloperAuthor Commented:
Checked those

bootstrap.php is totally commented out so it does nothing.
There is not even an index.php file anywhere in that directory

Code below includes PHP that complete the page, so I look for the HTML that writes to complete the page including css unique to the lines that are written but can't even find that. Tried a site wide search and no luck lol
                          <div id="centerColWrapperArtist">
                                                                <div><?php echo $image->display('content.header.default.artist.gif', array('alt' => '')); ?></div>
                                                                <div id="centerColArtist">
                                                                        <div id="centerColContent">
                                                                                <?php if($session->check('Message.flash')) $session->flash(); ?>
                                                                                <?php echo $content_for_layout;?>
                                                                        </div>
                                                                </div>
                                                                <div><?php echo $image->display('content.footer.default.artist.gif', array('alt' => '')); ?></div>
                                                        </div>

Open in new window

0
 
Ryan BayneWordPress DeveloperAuthor Commented:
I've even tried site wide searches for specific text but it never finds anything from the parsed page source code within the area of the page above.

Don't suppose you have any ideas along those lines that might work better?
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Steve BinkCommented:
Post bootstrap.php and I'll take a look through it.  Also, see here:

http://www.php.net/manual/en/function.get-included-files.php

You can use that to at least find out what files are included, and reconstruct the chain from the code.  If you're on *nix, use the grep command to search the files.  If you're on Windows...well, there's probably a made-for-windows grep utility out there.  The text search built into Explorer is a tad untrustworthy.
0
 
Ryan BayneWordPress DeveloperAuthor Commented:
Don't know if I should thank you or not lol Thats exactly what I needed but I did not expect so many included files!

Is this normal?  There is a datasouce and a database file, an image.php and string.php! Sounds more like functions.

Does this not slow PHP down some including so many? Anyway that aside I got to go through them all now and figure this website out. I'll get back to you, theres 2 bootstrap files so maybe I looked in wrong once also.

Thanks get back to you later, much later
/usr/www/users/pang07/cake/app/webroot/index.php 
/usr/www/users/pang07/cake/cake/bootstrap.php 
/usr/www/users/pang07/cake/cake/basics.php 
/usr/www/users/pang07/cake/app/config/core.php 
/usr/www/users/pang07/cake/cake/config/paths.php 
/usr/www/users/pang07/cake/cake/libs/object.php 
/usr/www/users/pang07/cake/cake/libs/cache.php 
/usr/www/users/pang07/cake/cake/libs/session.php 
/usr/www/users/pang07/cake/cake/libs/set.php 
/usr/www/users/pang07/cake/cake/libs/security.php 
/usr/www/users/pang07/cake/cake/libs/inflector.php 
/usr/www/users/pang07/cake/cake/libs/configure.php 
/usr/www/users/pang07/cake/app/config/bootstrap.php 
/usr/www/users/pang07/cake/cake/libs/cache/file.php 
/usr/www/users/pang07/cake/cake/libs/folder.php 
/usr/www/users/pang07/cake/app/tmp/cache/persistent/class.paths.php 
/usr/www/users/pang07/cake/cake/dispatcher.php 
/usr/www/users/pang07/cake/cake/libs/router.php 
/usr/www/users/pang07/cake/cake/libs/controller/controller.php 
/usr/www/users/pang07/cake/cake/libs/controller/component.php 
/usr/www/users/pang07/cake/cake/libs/view/view.php 
/usr/www/users/pang07/cake/cake/libs/view/helper.php 
/usr/www/users/pang07/cake/cake/libs/overloadable.php 
/usr/www/users/pang07/cake/cake/libs/overloadable_php5.php 
/usr/www/users/pang07/cake/cake/libs/class_registry.php 
/usr/www/users/pang07/cake/app/config/routes.php 
/usr/www/users/pang07/cake/app/app_controller.php 
/usr/www/users/pang07/cake/app/controllers/art_profiles_controller.php 
/usr/www/users/pang07/cake/app/config/inflections.php 
/usr/www/users/pang07/cake/cake/libs/controller/components/email.php 
/usr/www/users/pang07/cake/cake/libs/controller/components/session.php 
/usr/www/users/pang07/cake/cake/libs/model/model.php 
/usr/www/users/pang07/cake/cake/libs/validation.php 
/usr/www/users/pang07/cake/cake/libs/model/behavior.php 
/usr/www/users/pang07/cake/cake/libs/model/connection_manager.php 
/usr/www/users/pang07/cake/cake/libs/model/datasources/datasource.php 
/usr/www/users/pang07/cake/app/config/database.php 
/usr/www/users/pang07/cake/cake/app_model.php 
/usr/www/users/pang07/cake/app/models/art_profile.php 
/usr/www/users/pang07/cake/cake/libs/model/datasources/dbo_source.php 
/usr/www/users/pang07/cake/cake/libs/model/datasources/dbo/dbo_mysql.php 
/usr/www/users/pang07/cake/app/models/user.php 
/usr/www/users/pang07/cake/app/models/artist_profile.php 
/usr/www/users/pang07/cake/app/models/state.php 
/usr/www/users/pang07/cake/app/models/music_profile.php 
/usr/www/users/pang07/cake/app/models/genre.php 
/usr/www/users/pang07/cake/app/models/category.php 
/usr/www/users/pang07/cake/app/models/literature_profile.php 
/usr/www/users/pang07/cake/app/models/attachment.php 
/usr/www/users/pang07/cake/app/models/content.php 
/usr/www/users/pang07/cake/app/models/navtag.php 
/usr/www/users/pang07/cake/app/models/literature_product.php 
/usr/www/users/pang07/cake/app/models/literature_product_image.php 
/usr/www/users/pang07/cake/app/models/music_product.php 
/usr/www/users/pang07/cake/app/models/music_product_image.php 
/usr/www/users/pang07/cake/app/models/music_profile_image.php 
/usr/www/users/pang07/cake/app/models/favorite.php 
/usr/www/users/pang07/cake/app/models/comment.php 
/usr/www/users/pang07/cake/app/models/art_product.php 
/usr/www/users/pang07/cake/app/models/art_product_image.php 
/usr/www/users/pang07/cake/app/models/variable.php 
/usr/www/users/pang07/cake/app/models/waiting_profile.php 
/usr/www/users/pang07/cake/app/models/visit.php 
/usr/www/users/pang07/cake/cake/app_helper.php 
/usr/www/users/pang07/cake/cake/libs/view/helpers/html.php 
/usr/www/users/pang07/cake/cake/libs/view/helpers/form.php 
/usr/www/users/pang07/cake/cake/libs/view/helpers/session.php 
/usr/www/users/pang07/cake/cake/libs/view/helpers/javascript.php 
/usr/www/users/pang07/cake/app/views/helpers/image.php 
/usr/www/users/pang07/cake/app/views/helpers/string.php 
/usr/www/users/pang07/cake/app/views/helpers/seo.php 
/usr/www/users/pang07/cake/app/views/helpers/swf.php 
/usr/www/users/pang07/cake/app/views/helpers/wimpy.php 
/usr/www/users/pang07/cake/cake/libs/view/helpers/xml.php 
/usr/www/users/pang07/cake/app/views/art_profiles/view.ctp 
/usr/www/users/pang07/cake/app/views/elements/comments.ctp 
/usr/www/users/pang07/cake/app/views/layouts/default_artist_art.ctp 
/usr/www/users/pang07/cake/app/views/layouts/SEO_Functions.php

Open in new window

0
 
Steve BinkCommented:
Define 'normal'.  :)

CakePHP is a framework, which means it introduces a ton of functions and features that are not inherent in PHP itself.  Yes, it slows things down, and every page you render through Cake will probably need to load a majority, if not all plus more, of the files you listed.  

Put simply, you are running your web site's application through a PHP application (CakePHP), which in turn runs through PHP.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now