Stefano Mtangoo 455 Senior Poster

I have simple question.
I have long code in my .cpp file with classes functions etc.
I would like to divide it into separate cpp and .h files. What are rules governing the stuffing? Any good tutorial/example?
Cheers :)

Stefano Mtangoo 455 Senior Poster

I think alot of people go for fun and some like me are holding back due to lack of libraries fo Python3. I'm still with my 2.5

Anyway, just for wxpython users, there are new binaries for 2.6 and obviously all other except 3, fixing the wxpython problems for manifest once Scru pointed out :)

Stefano Mtangoo 455 Senior Poster

if you produce simple example it will help alot including me. I believe it is easier to make exe with C/C++ than python. So if it is that easier I would prefer it!

Stefano Mtangoo 455 Senior Poster

Ok I messed up line 17, it should have been

MyFrame *newFrame = new MyFrame(wxT("Hello Mary!"));
Stefano Mtangoo 455 Senior Poster

Ok, I realize that. I used console instead of wxWidgets. Really I jumped on broken glass and guess what? :)

Now When I compile it gives me some sort of errors

C:\Documents and Settings\smtangoo\My Documents\C++ projects\steve\steveApp.cpp||In member function `virtual bool MyApp::OnInit()':|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\steve\steveApp.cpp|17|error: no matching function for call to `wxFrame::wxFrame(const wchar_t[12])'|
C:\Program Files\CodeBlocks\wxWidgets-2.8.10\include\wx\msw\frame.h|168|note: candidates are: wxFrame::wxFrame(const wxFrame&)|
C:\Program Files\CodeBlocks\wxWidgets-2.8.10\include\wx\msw\frame.h|27|note: wxFrame::wxFrame(wxWindow*, wxWindowID, const wxString&, const wxPoint&, const wxSize&, long int, const wxString&)|
C:\Program Files\CodeBlocks\wxWidgets-2.8.10\include\wx\msw\frame.h|19|note: wxFrame::wxFrame()|
||=== Build finished: 1 errors, 0 warnings ===|

Stefano Mtangoo 455 Senior Poster

After pondering and wondering, I have decided to go for wxWidgets. Here is my first trial application. After running a test app from zetcode.com in my Code::Blocks & wxWidgets and I confirmed that it is fine! Then I tried to write my own app as shown below but I ran errors. Please correct me wher I have gone wrong, and any suggestion in the code. I'm just starting with wxWidgets
Cheers :)

#include <wx/wx.h>
class MyApp : public wxApp
{
    virtual bool OnInit();
};

class MyFrame : public wxFrame
{
    public:
        MyFrame(const wxString& title);
};

IMPLEMENT_APP(MyApp);

bool MyApp::OnInit()
{
    wxFrame *newFrame = new wxFrame(wxT("Hello Mary!"));
    newFrame->Show();
    return true;
}

MyFrame::MyFrame(const wxString& title)
       : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150))
{
  Centre();
}

Errors:

C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|1|wx/wx.h: No such file or directory|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|3|error: expected class-name before '{' token|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|8|error: expected class-name before '{' token|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|10|error: expected `,' or `...' before '&' token|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|10|error: ISO C++ forbids declaration of `wxString' with no type|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|13|error: expected constructor, destructor, or type conversion before ';' token|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp||In member function `virtual bool MyApp::OnInit()':|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|17|error: `wxFrame' was not declared in this scope|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|17|error: `newFrame' was not declared in this scope|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|17|error: `wxFrame' is not a …

Stefano Mtangoo 455 Senior Poster

It have been easier for me to "Hard code" than using designers. You have complete control over the code and can do any change and of course code re-use :)

Stefano Mtangoo 455 Senior Poster

Thanks Sir,
As far as I'm concerned. the case is closed!!
I will go for wxWidgets. Goodbye GTK+ and QT!

Stefano Mtangoo 455 Senior Poster

I haven't have a choice yet. I want to go for wxWidgets due to wxpython background. Before that I want to test The rest. How do you see guys, should I just start with wxWidgets and shut eyes on others? :)

Stefano Mtangoo 455 Senior Poster

I wonder if there are GTK+ users or my question isn't well framed!
To try elaborate, How do I need to try GTK+ with C++. What makes difference between GTK+ and gtkmm? How do I use it with CodeBlocks?

I'm trying wxWidgets right now, I will try GTK+ next then QT. But I don't know anything about how to go about GTK!

Stefano Mtangoo 455 Senior Poster

I'm trying GUI Library to see what fits me. I want to try GTK+ too. But I don't know where to start. At GTK+ site I took a look at C++ bindings http://www.gtkmm.org/ and found
* glibmm 2.20 (stable)
* gtkmm 2.16 (stable)
* libgnomecanvasmm (stable)
* gconfmm (stable)
* libgdamm
* libpanelappletmm 2.6 (unstable)
* gtkmm-hello 2.4
What is what? Which is which?? :)

Stefano Mtangoo 455 Senior Poster

Great man! I appreciate!

Stefano Mtangoo 455 Senior Poster

I have two files and I would like to call addition function from functions.cpp in main.cpp. But I get error:

In function `int main()':
error: `addition' has both `extern' and initializer
error: initializer expression list treated as compound expression
warning: left-hand operand of comma has no effect
error: `addition' cannot be used as a function|
||=== Build finished: 3 errors, 1 warnings ===|

Here are files
main.cpp

#include <iostream>

using namespace std;

int main()
{
    int summation;
    int a, b;
    cout <<"Please Enter the two digits to add"<<endl;
    cin>>a>>b;
    //add external f(x) from function.cpp
    extern int addition(a, b);
    summation = addition(a, b);
    cout<<"The sum is "<<summation;
    return 0;

}

functions.cpp

int addition(int a, int b)
{
    int sum;
    sum = a+b;
    return(sum);
}
Stefano Mtangoo 455 Senior Poster
tux4life commented: Nice book :) +2
Stefano Mtangoo 455 Senior Poster

Thanks Big Man! I appreciate your co operation!
Let me see and ponder on your options.

Stefano Mtangoo 455 Senior Poster

check disk get terminated with unknown error occured.
I will check to see what more I can do, but anything is appreciated

Stefano Mtangoo 455 Senior Poster

partitions are there but one cannot get opened, and another get opened and you see no files! Very strange, I almost every time invoke chkdsk with /r and /f but guess what, the same problem.

Stefano Mtangoo 455 Senior Poster

Please help me guys. My Disk have corrupted and chkdsk have failed to repair although it have detected the corruption. It is external HDD and I don't know if there is any tool I can use apart chkdsk. Both partition in the drive are corrupt and they have my very important Data.

I hope to hear from you guys
I have attached the screenshots.
Thanks alot!

Stefano Mtangoo 455 Senior Poster

Maybe wxWidgets as it matches with your avatar :P ...

Hahaha! That avatar represent wxpython, the python bindings for wxWidgets. I will try both, but starting with wxWidgets, since it have been my default in python.

Just curious question(though I will post it in python in due time) have also pyQT went to LGPL?

Stefano Mtangoo 455 Senior Poster

That is great, man!
I removed # include "hello.cpp" and added return 0 at end of funny_words() and used extern int funny_words()

Guess what! It worked!
Thanks alot sir! Thank you!

Stefano Mtangoo 455 Senior Poster

Thanks guys, I love your suggestions. One trouble I had with QT and its pyQT was licencing issues. Someone have said I have to link shared library and I will be fine, but that is hard cookie to a little babe :)
I'm still learning console apps and haven't done much with Linking anything, so can anyone help me with grain of salt!

Thanks all!

Stefano Mtangoo 455 Senior Poster

Hello all,
I'm trying to link two files but I get error "multiple definition of `funny_words()' " I don't know what to do, as I'm new to C++. I'm reading PROGRAMMING IN C++ by P.B. Mahapatra and the topic is PREPROCESSOR. I have to learn how to Link headers, and cpp files using # include. My first trial with cpp have failed.

Soo much words, but here are two source codes:
1. main.cpp

#include <iostream>
#include "hello.cpp"
using namespace std;
//declare the class
class triangle{
    //only visiblein class, invisible outside
    private:
        int base;
        int height;
        int area;
    //visible both in and outta class
    public:
        int triangle_area();
        int get_values();
};

int triangle::triangle_area()
{
    area = 0.5*base*height;
    return(area);
}

int triangle::get_values()
{
    //prompt for triangle base
    cout<<"Please Enter the value of the triangle base"<<endl;
    cin>>base;
    //prompt for triangle height
    cout<<"Please Enter the value of the triangle height"<<endl;
    cin>>height;
}

int main()
{
    class triangle ABC;
    ABC.get_values();
    int area;
    area = ABC.triangle_area();
    cout<<"The area of Triangle is "<<area <<endl;
    funny_words();
    return 0;
}

2. hello.cpp

#include <iostream>
#include <cmath>
#define GEQUAL >=

using namespace std;
//function to display some funny words
int funny_words()
{
    int iq_test;
    cout<<"What is your IQ ?"<<endl;
    cin>>iq_test;
    if (iq_test GEQUAL 50)
        cout<<"You got it! Excellent!"<<endl;
    else
        cout<<"Sorry! you need to pray more for wisdom!"<<endl;
}

Thanks all!

Stefano Mtangoo 455 Senior Poster

Ok I have made a progress
I have successful embeded my js code in php. The problem is, the list doesn't load! I wonder if one can see the error I have made!

Note: I forgot to say that my index file is at "/elijah/index.php" and the player is at "/elijah/player"

the code I have embedded in my index.php

<?php
echo "<script language='javascript' src='/elijah/player/swfobject.js'> </script> \n ";
echo "<div id='flashPlayer'> \n ";
echo "  This text will be replaced by the flash music player.\n ";
echo "</div>\n";
echo "<script language='javascript'>\n ";
echo "  var so = new SWFObject('/elijah/player/playerMultipleList.swf', 'mymovie', '295', '200', '7', '#FFFFFF')\n ";
echo "   so.addVariable('autoPlay','no')\n ";
echo "   so.addVariable('playlistPath','/elijah/player/playlist.xml')\n ";
echo "   so.write('flashPlayer')\n ";
echo "</script> \n ";
?>
Stefano Mtangoo 455 Senior Poster

Hi all,
I have MP3 player from
http://www.premiumbeat.com/flash_resources/free_flash_music_player/multiple_tracks_mp3_player_menu.php
and I want to put it in my page. I want it to appear in every page. I'm pretty new to many PHP stuffs and with PHP page I judt do simple include statement. How do I do that?

Here is their sample code to use with player and it works when the file is in the same folder. I know almost nothing about javascripting
Thanks!

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sample Flash Music Player Embed Code</title>
</head>
<body>

<!--
INSTRUCTIONS
* Change autoPlay to "yes" if you want the music track to start automatically once loaded

More instructions at:
http://www.premiumbeat.com/flash_resources/free_flash_music_player/multiple_tracks_mp3_player_menu.php

-->

<!-- Begin Copy/Paste -->

<script type="text/javascript" src="swfobject.js"></script>
		
<div id="flashPlayer">
  This text will be replaced by the flash music player.
</div>

<script type="text/javascript">
   var so = new SWFObject("playerMultipleList.swf", "mymovie", "295", "200", "7", "#FFFFFF");  
   so.addVariable("autoPlay","no")
   so.addVariable("playlistPath","playlist.xml")
   so.write("flashPlayer");
</script>

<!-- End Copy/Paste -->

</body>
</html>
Stefano Mtangoo 455 Senior Poster

Yeah, I mean CLOSED SOURCE AND COMMERCIAL
So if LGPL allows that and everything is as you have said, choice becomes to user, am I right?

Stefano Mtangoo 455 Senior Poster

Great SCRU,
I ask because I use wxpython in Python (remember me?). I have been a little busy and disappeared for a while! I prefer wxpython in Python but any of two (QT or wxWidgets) is ok for me, provided it fulfills what I need. Your conribution is fine.

Here is my Question about LGPL and QT, does it allow me to use it commercially (If I wish to) with no restriction like previous? Then here is another question, is there free book about QT 4.5?

Great to meet you Scru,
have good time

Stefano Mtangoo 455 Senior Poster

Just a curious Question. What do you prefer, QT or wxWidgets?
How do compare the two in terms of:
1. Nativity
2. Easiness to learn
3. Documentation
4. Weight (The size in MB)
5. Licencing
6. Any other factor(AOF)

Thanks all!

Stefano Mtangoo 455 Senior Poster

Thanks sir, I will practice that!
Anyone who wants to add any valuable info in addition to this is welcomed too!
Thanks 3Magine

Stefano Mtangoo 455 Senior Poster

Hello all,
I have been teaching myself PHP through others writting; so bear with me if you find something foolish.

Having said so, I want to make a simple Music library with MySQL/PHP. I have made this very simple Login form as shown below. I want after someone successful login be redirected where he can populate things in Library. The he should be able to see it via another PHP file. Here are my Questions:
1. How do I redirect a page after successful login?
2. How do I make a dynamic table that I can alter its cells anytime? I mean when one adds his music the PHP file should print the table with cells full of all info.
3. Supplemently, can one recommend tutorial that can help me to achieve what I have said?

Thanks all :)

// This is login.php
<html>
	<head>
		<title> Login</title>
	</head>

	<body>
		<form action ="login.php" method = "post" >
			<p> User name 
			<input type = "text" name = "user" />
			</p>
			<p> Password  
			<input type = "password" name = "pass" />			
			<input type = "submit" value = "Go" />
			</p>
		</form>	
	<?php 
		$user = $_POST["user"];
		$pass = $_POST["pass"];
		if (($user=="elijah")&&($pass=="jesus" )) echo "Access provided, Enjoy $user !";
		else 	echo "Access denied, please $user contact your system Admin ";
	?>
	</body>

</html>

Here is the fill in form

//fill_in.php
<form action="/projects/LearningPHP/include/inc.get_results.php" method="post" >
	<p>Year:</p>
	<p><input type="text" name="album_year" /></p>
	
	<p>Album:</p>
	<p><input type="text" name="album_name" /></p>
	
	<p>Artist:</p>
	<p><input type="text" name="album_artist" /></p> …
Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

Thanks all.
Paul, I also enjoyed the same tutorial too. The only thing I wanted to know if there is anything I need to know before attempting writting my Own chat program. According to Murtan, peer to peer is easy. What if I want to use yahoo server or msan or etc or my own server how can this be accomplished?

Stefano Mtangoo 455 Senior Poster

sorry guys, here is the css

/* 
    Document   : elijah
    Created on : 02-Nov-2008, 17:15:16
    Author     : Elijah Ministries
    Description:
        Purpose of the stylesheet follows.
*/

/* 
   TODO customize this sample style
   Syntax recommendation http://www.w3.org/TR/REC-CSS2/
*/

body {

     /* background: #A4ACB2 url("/projects/elijah/forum/styles/avalon/theme/images/body.gif");*/
    background-color:silver;
    font-family: Verdana,Helvetica,Arial,sans-serif;
    font-style: normal;
    font-weight:normal;
    font-size: 10px;
    color: black; 
    margin:0;
    padding-left:20px;
    padding-right:20px;
    padding-bottom:5px;
    padding-top:0;
        }
    /* Links*/

    A:link {
            text-decoration: none;
            color: red;
}
    A:hover {
            text-decoration: none;
            color: red;
}
    A:active {
            text-decoration: none;
            color: red;
}
    A:visited {
            text-decoration: none;
            color: red;
}


h3{    text-decoration:none;
       font-weight:bold;
        color:black;
        padding-left:15px;
        


}
h4{
        text-decoration:none;
        font-weight:bold;
        color:black;
        padding-left:15px;
        text-align:center;

}

i{
    color:black;
}

p{
    font-family: Verdana,Arial,Helvetica,sans-serif;
    font-style: normal;
    font-weight:normal;
    font-size: 12px;
    margin-top: 5px;
    margin-bottom: 5px;
    margin-left: 5px;
    margin-right: 5px;
    padding-top: 5px;
    padding-bottom: 5px;
    padding-left: 5px;
    padding-right: 5px;
    color: black;

}

#main {
				width:99%;
}

#header{
            
    background-color: #007F78 ;
}

#header_menu{
		background-color:green;
		color:white;
		padding:5;
		margin:0;
		border:1px dashed white;
		line-height:1.5em;
}
#htext{

    color: white;
    text-align:center;
    font-weight: bold;
     background: url("/forum/styles/avalon/theme/images/logo_bg_headtext.gif") top left repeat-x;
     width:100%;
     height:65px;
     font-size:12px;
    }

#leftbar {
   
   	float:left;
    width: 230px;
    text-decoration:none;
    color:black;
    background-image: url("/projects/elijah/images/backgl.png");
    padding:5px 15px 5px 5px;
    
   
}

#mainarea{
    background-color: #ffffff;   
    margin:0;
    padding:10px;	
		overflow: hidden;
		height:100%;
	

}

#footer{

    background-color:black;
    color:white;
    text-align:center;
    color:white;
    height:50px;
    font-size:11px;
    float:left; 
		width:100%;
    
		}

.qt {

    font-style:italic;
    font-family: Verdana,Arial,Helvetica,sans-serif;
    font-weight:normal;
    font-size: 12px;    
    margin: 5px;
    padding: 3px;
    border-style: solid;
    border-width: 1px;
    background-color: #cccccc;
    color: black;

    border-top-color: #666666;
    border-bottom-color: #666666;
    border-left-color: #666666;
    border-right-color: #666666;
}

.separator{
		background-color:maroon;
		height:10px;
}

.pop_window{
		border:1px;
		background-color:red;
}

.lister {
			list-style-type: none; 
			background-image:url("/projects/elijah/images/list.png");	
			background-position:0 50%;
			background-repeat:no-repeat;
			padding-left:30px;


}

.tip{
		margin-top:2px; …
Stefano Mtangoo 455 Senior Poster

I will advice you to do what I always call "hard coding". It is coding from scratch. This have these advantages:
1. You make exactly what you want
2. You know how things works
3. You can reuse some parts of code
4. Etc.

Having said so, here are some editors/IDE for mainly PHP but will do also HTML

1. Notepad++ (Editor)
2. Netbeans (IDE)
3. DevPHP (IDE)
4. CodeLobster(IDE)
5. PHP Designer Personal Edition(IDE)

All are free, though I prefer Netbeans!

Stefano Mtangoo 455 Senior Poster

I have the page and the main page doesn't get to bottom. In short it doesn't fit up. Take the code and see what I mean. If you don't know PHP just replace it with <p> Garbage words</p>

<!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" xml:lang="en-US" dir="ltr" lang="en-US">
		<head>
			<title>Test Page - Elijah Ministries</title>
			<link rel="stylesheet" type="text/css" href="/projects/elijah/elijah.css" />
		</head>
		
		<body>
			<?php
				$paths = getcwd(); // get the current working DIR path
			?>
		<!-- Main carrier to the web page -->
		<div>
			<!-- Header -->
			<div id="header"> 
			<br />
			<?php
				include("$paths/include/inc.header.php"); // include the header code
			?>
			</div>
			<!--Navigation Bar -->
			<div id="header_menu"> 
				<!-- Table for Menu -->
					<table style="text-align: left; width: 100%;" border="2" cellpadding="2" cellspacing="0">
					  <tr>
					  		<!-- Left Top Menu -->
					      <td>
									<?php
										include("$paths/include/inc.top_menu.php"); // include the header menu code
									?>
								</td>
					      
								<!-- Middle Top Menu -->
					      <td>
									<?php
										include("$paths/include/inc.top_menu2.php"); // include the header menu code
									?>
								</td>
					      
								<!-- Right Top Menu -->
					      <td>
									<?php
										include("$paths/include/inc.top_menu3.php"); // include the header menu code
									?>
								</td>
								
					  </tr>
					</table>
			</div>
			
			<!--Left Link Bar -->
			<div id="leftbar">
				<?php
					include("$paths/include/inc.side_bar.php"); // include the Left sidebar menu code
				?>
			</div>
			<!--Right bar -->
			<div id="mainarea">
				<?php
					include("$paths/include/inc.main.php"); // include the header menu code
				?>
			</div>
			<!-- Footer -->
			<div id="footer">
				 <?php
						include("$paths/include/inc.footer.php"); // include the header menu code
					?>
			</div>
		</div>

		</body>
<html>
Stefano Mtangoo 455 Senior Poster

I have been in some tutorials for socket Module. It is very interesting.
I want to know what I need to Know to make simple peer to peer/Client server Chat software but I'm new to Network, so anything that will help me put things together?

Thanks Guys :)

Stefano Mtangoo 455 Senior Poster

Have made alook in network programming??

Stefano Mtangoo 455 Senior Poster

Can someone clarify me the difference between CHAR and VCHAR and which one is best to be default type in my all SQL queries?
Is it VCHAR or CHAR? :D

Stefano Mtangoo 455 Senior Poster

In a minute i will update

Stefano Mtangoo 455 Senior Poster

I'm beginner in PHP, and for long have been doing my site in XHTML. Now I want to make a News box and have made PHP code for that function as shown below:

<?php
function pop_boxes($words, $class)
	{
		$string = "<div $class> $words </div>";
		print($string);
	}
	?>

And here is how I call it as inc.container.php :

<div id="mainarea" style="padding:10;">
				<?php
				include("$paths/include/inc.main.php");					
				$words = "Try again";
				$class = "pop_window";
                                //the code are in the below file
				include("$paths/include/inc.container.php");	
				pop_boxes($words, $class);			
				?>
			</div>

and the class in CSS is only configure to have red background as test enviroment, that is:

.pop_window{
		border:1px;
		background-color:red;
}

It strangely prints "Try again" with no formatting and no <div> box. What is wrong?

Thanks for your help!
Stefano Mtangoo 455 Senior Poster

I have decided to use table until I get solution, so anybody can add anything to the thread

Stefano Mtangoo 455 Senior Poster

What happened?

Stefano Mtangoo 455 Senior Poster

Hi All,
Here is my Index code. How can I make footer be at the bottom of other div. In css I floated to left the leftbar and to right the main contents. The header is fine but footer comes just below main content instead of being at bottom of all divs. Please help me get it down

html>
	<head>
		<title>Test Page - Elijah Ministries</title>
		<link rel="stylesheet" type="text/css" href="/projects/elijah/elijah.css" />		
	</head>
	
	<body>	
	<!--carries the whole Website -->
		<div id="main">
		
			<!--Header -->
			<div id="header">
				<?php
				$paths = getcwd();
				include("$paths/include/inc.header.php");
				?>
			</div>
			
			<!--Navigation bar -->
			<div id="nav">
				<?php
				//$paths = getcwd();
				//include("$paths/include/inc.header.php");
				?>
			</div>
			
			<!--Left bar Links -->
			<div id="leftbar">
				<?php
					include("$paths/include/inc.nav_links.php");
					print ("<br />");
					include("$paths/include/inc.mailing_list.php");
					print ("<br />");
					include("$paths/include/inc.elijah.php");
				?>
			</div>
			
			<!--right bar main contents -->
			<div id="mainarea">
			Right bar
			</div>
			
		<!--Footer -->
		<div id="footer">
			<?php
				include("$paths/include/inc.footer.php");
				?>
			</div>
		
		
		</div>
	
	
	</body>	
<html>
Stefano Mtangoo 455 Senior Poster

XAMPP Installs everything. Don't choose what to install unless you are sure. Also XAMPP configures stuffs that would be weird for Newbie to do. So I would say uninstall it and re-install it as full package :)

Stefano Mtangoo 455 Senior Poster

Yeah, that error is obvious, but I failed to see it. Thanks.
It is that I'm refactoring my old HTML code to incorporate PHP. However, My working folder in XAMPP ("/project/elijah/elijah.css") will not be valid when kept on server where path will be something like "/elijah.css". So I want to use path to avoid changing things in file, which is tedious work :)

Stefano Mtangoo 455 Senior Poster

May be question was too vague, here is another way,
I get path of current DIR via php script

<?php
$paths = getcwd();
?>

Then I want to use this path when linking all my image and css file
Here is my code linking the CSS file

<link rel = "sheet" style = "text/css" href = "/project/elijah/elijah.css"  />

How do I link the CSS file using $paths that is <link rel = "sheet" style = "text/css" href = "$paths/elijah.css" />

Thanks for your invaluable help

Stefano Mtangoo 455 Senior Poster

The best Package I love is WAMP. The only reason I use XAMPP in my USB stick is because WAMP isn't yet portable

Stefano Mtangoo 455 Senior Poster

+1 For stas, But here is my suggestion:
1. Netbeans
2. Codebloster
3. PHP Designer 2007 Personal Edition
For freeware

For $ based IDEs Check DreamWeaver. :)

iamthwee commented: good stuff +18
Stefano Mtangoo 455 Senior Poster

foreach($array as $value) simply means, for every element in the array, assign its value to $value.
foreach($array as $key => $value) assigns the index of the array to $key and value of that index to $value.
:S I hope I am not confusing you!
This is almost similar to for loop.

for($i=0;$i<count($array);$i++) {
  echo "Key is".$i."Value is".$array[$i];
}
//is same as
foreach($array as $key =>$value) {
 echo "Key is".$key."Value is".$value;
}

You can try some examples here:
http://www.php.net/foreach
http://www.tizag.com/phpT/foreach.php

Stefano Mtangoo 455 Senior Poster

Ok I have this code:
How do I link the CSS file using PHP in that, Instead of full CSS path I will have href="$paths/elijah.css" ?

Thanks for your valuable reply

html>
	<head>
		<title>Test Page - Elijah Ministries</title>
		<?php
				$paths = getcwd();
				print $paths;
				?> 
		<link rel = "sheet" style = "text/css" href = "/project/elijah/elijah.css"  />
	</head>
	
	<body>
		<table width="100%" height="450px" bgcolor="silver">
			<tr>
				<td class="top_header">
				
				</td>
			</tr>
		</table>
	
	
	</body>
	
<html>
Stefano Mtangoo 455 Senior Poster

Can you comment on code so as I ca understand better