Intranet Journal

Go Back   IT Management Forum > Intranet Journal

Intranet Journal The new discussion forum for Intranet Journal readers. Leave comments and questions for IJ authors. Suggest story ideas and provide feedback.

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-07-2008, 03:08 PM
Rebecca_D Rebecca_D is offline
Registered User
 
Join Date: Jul 2008
Posts: 2
Unhappy Creating a PHP-Based Content Management System, Part 2

PHP newbie here! In this second part of the CMS development article (http://www.intranetjournal.com/artic...08_05_04a.html) the code asks for a variable to be set which refers to the path to the server on an Intranet

// System variables
$settings['siteDir'] = '/path/to/your/intranet/';

I intend to upload this CMS onto an Internet server so will the path just be the root ie. '/'?

Rebecca
Reply With Quote
  #2 (permalink)  
Old 08-06-2008, 02:24 AM
marzar00 marzar00 is offline
Registered User
 
Join Date: Jun 2008
Posts: 22
Ask you host for this.

Marzar
Reply With Quote
  #3 (permalink)  
Old 08-14-2008, 02:51 AM
simon simon is offline
Registered User
 
Join Date: Aug 2008
Posts: 3
Upload a page with the following content <?php phpinfo(); ?> and it will give you the information you want
Reply With Quote
  #4 (permalink)  
Old 08-17-2008, 08:58 AM
kooperG kooperG is offline
Registered User
 
Join Date: Aug 2008
Posts: 7
Could you perhaps give a bit more clues?
The php info list is huge, with a lot of (virtual) directories.
Which label or so should i be looking for?

i see at least the following choices:

./configure' '--prefix=/opt/RZphp5' '--with-jpeg-dir=../local' '--with-gd' '--with-png-dir=../local' '--with-freetype-dir=../local' '--with-expat-dir=../local' '--with-iconv-dir=../local' '--with-iconv=../local' '--with-mysql=../local' '--with-mysqli=../local/bin/mysql_config' '--with-libxml-dir=../local' '--with-zlib=../local' '--with-zlib-dir=../local' '--with-db2=../local' '--with-ndbm' '--with-gdbm=../local' '--with-mhash=../local' '--with-mcrypt=../local' '--with-bz2=../local' '--with-xsl=../local' '--with-ming=../local' '--with-idn=../local' '--with-gettext=../local' '--with-imap=../local/c-client' '--with-tidy=../local' '--with-mssql=../local' '--with-sqlite' '--enable-mailparse' '--enable-mbstring' '--disable-mbregex' '--disable-hash' '--enable-zip' '--enable-yats' '--enable-dba' '--enable-discard-path' '--enable-sysvshm=yes' '--enable-sysvsem=yes' '--enable-debug=no' '--enable-bcmath=yes' '--enable-safe-mode=yes' '--with-exec-dir=/opt/RZphp5/exec' '--with-config-file-path=/opt/RZphp5/etc' '--enable-memory-limit' '--enable-pear' '--enable-pcntl' '--enable-calendar' '--enable-dbase' '--enable-wddx' '--enable-trans-sid' '--enable-ftp' '--enable-exif'

include_path .:/opt/RZphp5/includes

safe_mode_include_dir /opt/RZphp5/includes

etc

Thanks a lot!!!
Reply With Quote
  #5 (permalink)  
Old 08-17-2008, 09:52 AM
kooperG kooperG is offline
Registered User
 
Join Date: Aug 2008
Posts: 7
ok, never mind the message above. The first poster actually gave the answer already... (using '/' worked).

But, however, i am getting an error all the time:


Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in blablablablabla/includes/DbConnector.php on line 34
Your selected article:


This happens when i want to go to an article..
Line 30 to 35 in dbconnector is as follows:

}

function fetchArray($result) {

return mysql_fetch_array($result);
}



is there any thing i can do about this...? all other things seem to work and i dont want to continue with validating untill i see the script works and so.

Thanks again
Reply With Quote
  #6 (permalink)  
Old 08-17-2008, 10:14 AM
kooperG kooperG is offline
Registered User
 
Join Date: Aug 2008
Posts: 7
Ok now, this is the second time it happens to me in 2 minutes that the answer i ask for is already posted here. (search the forum!!! i know i should have )

the solution is simple. Written for php4, if you use php5 you just replace a bit of code in the viewarticle.php:
Quoted from the following topic:
Problem with CMS Tutorial
<q>
But, since you included the text: Your selected article: it suggests that the problem is produced by $row = $connector->fetchArray($result); in line 14 of viewArticle.php and is caused by line 11 $result = $connector->query('SELECT title,thearticle FROM intra_cmsarticles WHERE ID = '.$HTTP_GET_VARS['id']);

Now, depending on your setup - and I know nothing about your setup - the problem could be caused by the $HTTP_GET_VARS['id']); part, and changing it to $_GET['id']); may solve the problem.

Now, since the long form $HTTP_GET_VARS[ and $HTTP_POST_VARS[ are deprecated it always is a good idea too replace all occurrences of $HTTP_GET_VARS[ with $_GET[ and all occurences of $HTTP_POST_VARS[ with $_POST[
</q>


My viewArticle.php now looks like this and it works:


<?php

require_once('../includes/DbConnector.php');

$connector = new DbConnector();

// IMPORTANT!!! Validate the ID number. See next article

$result = $connector->query('SELECT title,tagline,thearticle FROM cmsarticles WHERE ID = '.$_GET['id']);

$row = $connector->fetchArray($result);

?>

Your selected article:<?php echo $row['title,tagline'];?>
<br><br>
<?php echo $row['thearticle'];?>



now my next thing, to get it to display in Centercontent (css) instead of on a new empty white page..... and to make it validate..... damn i better call a friend who really knows this shit
me = noob :S
Reply With Quote
  #7 (permalink)  
Old 08-17-2008, 05:56 PM
marzar00 marzar00 is offline
Registered User
 
Join Date: Jun 2008
Posts: 22
Yes that is correct KooperG, $HTTP_GET_VARS[ and $HTTP_POST_VARS[ are deprecated. However the original post is asking for a site path.

@ Rebecca_D: if you are still having issues with this and haven't had any success with your host I will post mine as an example:

localhost/marzars-box/

It is localhost because I host it myself.

I hope this helps,

Marzar
Reply With Quote
  #8 (permalink)  
Old 08-18-2008, 03:11 AM
kooperG kooperG is offline
Registered User
 
Join Date: Aug 2008
Posts: 7
ah, yes, i am of the topic-hijacking kind

( see my 2nd message:
" ok, never mind the message above. The first poster actually gave the answer already... (using '/' worked).")
Reply With Quote
  #9 (permalink)  
Old 08-18-2008, 03:16 AM
Rebecca_D Rebecca_D is offline
Registered User
 
Join Date: Jul 2008
Posts: 2
Thanks

Many thanks to Simon, Marzar00 and KooperG for replying to this question. Your replies were very helpful.

Rebecca
Reply With Quote
  #10 (permalink)  
Old 01-29-2009, 11:49 AM
brunswick brunswick is offline
Registered User
 
Join Date: Jan 2009
Posts: 7
Quote:
Originally Posted by marzar00
Yes that is correct KooperG, $HTTP_GET_VARS[ and $HTTP_POST_VARS[ are deprecated. However the original post is asking for a site path.

@ Rebecca_D: if you are still having issues with this and haven't had any success with your host I will post mine as an example:

localhost/marzars-box/

It is localhost because I host it myself.

I hope this helps,

Marzar
Hi,

Thought I'd come out of lurk mode cause this sounds like my problem. Like you I have apache/php/mysql on my own vista based laptop. I'm just starting this tutorial and having the usual newby hiccups.

I've created a folder "cms" in my htdocs directory. Created a database "cms" and a table "cmsarticles" with the appropriate fields.

In SystemComponent I've called dbhost='localhost' dbusername='root' dbpassword='Correct Password' and dbname='cms' and siteDir='/'

Question: for the path should I create another folder in htdocs and then say /localhost/"name of new folder"/

I don't get any errors when I load the newArticle.php page but when I try to submit I get "Sorry, there was an error saving to the database" (I didn't know what to fill in the "Section" blank because I'm not sure what this means.)

Any help would be welcome.

Hank
Reply With Quote
  #11 (permalink)  
Old 01-30-2009, 01:53 AM
FaT3oYCG FaT3oYCG is offline
Registered User
 
Join Date: Jan 2009
Posts: 11
"Section" is basically a number for the section of the site that the aticle will be held in, with more development you would be able to display only the articles that were relevant to a specific part of the site.

in reply to your other error, have you created the database? if you have then did you follow the guide and create the table under your cms database as required?
Reply With Quote
  #12 (permalink)  
Old 01-30-2009, 07:19 AM
brunswick brunswick is offline
Registered User
 
Join Date: Jan 2009
Posts: 7
Quote:
Originally Posted by FaT3oYCG
"Section" is basically a number for the section of the site that the aticle will be held in, with more development you would be able to display only the articles that were relevant to a specific part of the site.

in reply to your other error, have you created the database? if you have then did you follow the guide and create the table under your cms database as required?
Hi,

Thank you for your reply and the explanation for "section". I presume I can leave that blank then for now.

Now to more important issues. Yes, I did create the database "cms" and the table "cmsarticles" with the appropriate fields. I used the MySQL command line client for this but I made sure it was there, using phpMyAdmin to check.

Now comes the real question: with my specific setup (see my previous post) what precisely follows "$settings['siteDir'] =" in SystemComponent.php?

Hank
Reply With Quote
  #13 (permalink)  
Old 01-30-2009, 01:29 PM
FaT3oYCG FaT3oYCG is offline
Registered User
 
Join Date: Jan 2009
Posts: 11
In my SystemComponent.php I have this

Code:
<?php
class SystemComponent {

	var $settings;

	function GetSettings() {

		// System variables
		$settings['BaseDir'] = 'http://gaming-network.ath.cx/';

		// Database variables
		$settings['dbhost'] = 'localhost';
		$settings['dbusername'] = 'root';
		$settings['dbpassword'] = 'Correct Password';
		$settings['dbname'] = '_cms';

		return $settings;
	}
}
?>
as the base dir doesnt really matter i dont think as i have the cms set up in /website/cms/ and it works fine I'm pretty sure its just to save you time later on if you decide to develop the system as i have not yet had chance myself.

as i follow these tutorials i change things to see if they work to improve upon my understanding which is why some of my settings are different.

If you still need more help just let me know.

Cheers

Craig
Reply With Quote
  #14 (permalink)  
Old 01-30-2009, 03:00 PM
FaT3oYCG FaT3oYCG is offline
Registered User
 
Join Date: Jan 2009
Posts: 11
my reply does not seem to be being posted

EDIT:

ok it did i just couldnt see it for some strange reason until i posted this.

Last edited by FaT3oYCG; 01-30-2009 at 05:40 PM.
Reply With Quote
  #15 (permalink)  
Old 01-30-2009, 03:42 PM
brunswick brunswick is offline
Registered User
 
Join Date: Jan 2009
Posts: 7
Quote:
Originally Posted by FaT3oYCG
my reply does not seem to be being posted
Hi Craig,

Evidently your reply did post because it's there.

I take it from your reply that '/' should work. This leaves me wondering why I get "Sorry, there was an error saving to the database" when I try to "submit" in the newArticle.php in cmsadmin.

I may have to put in an MySQL error trap to see what the real issue is.

Tks,

Hank
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 02:17 PM.





Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0