View Full Version : Making a simple website w/ PHP

11-15-2010, 02:28 AM
I am new to PHP because my web server plans never included it til now...

Also I bought a template...

But i dont know how to use the php in my site!

what is wrong with http://0324e96.netsolhost.com/ep.php

11-15-2010, 03:09 AM
Its exactly as the error says: the function is undefined. Why that is, have no idea. What is the template for? Are you using a standard CMS? There's no way we can guess or even help without details, and if its a non-standard CMS, you'll have to read code to figure out where it is.

In all honesty, starting to learn PHP with prebuilt code is a terrible way... you'll stumble, you'll learn things strangely, sometimes wrong, etc. Start your own basic projects and learn them, after some lessons in the basics.

11-15-2010, 03:31 AM
Its a template for my website from http://www.gabfirethemes.com/demos/blognews/

I know this isnt a good idea, but i never knew it had php and now i HAVE to get this working because it is costing me.

I dont know what is wrong with this code or what CMS even is

<!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">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="http://0324e96.netsolhost.com/custom.css" rel="stylesheet" type="text/css" />
<link href="http://0324e96.netsolhost.com/style.css" rel="stylesheet" type="text/css" />
<link href="http://0324e96.netsolhost.com/styles/default.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<style type="text/css" media="screen" />
#subnews .subnewspost {margin-left:8px}
#primartTopMidCol {margin-right:0;}

<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php if ( $bnews_options["feedlink"] <> "" ) { echo $bnews_options["feedlink"]; } else { echo bloginfo('rss2_url'); } ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php if ( $bnews_options["feedlink"] <> "" ) { echo $bnews_options["feedlink"]; } else { echo bloginfo('rss_url'); } ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_get_archives('type=monthly&format=link'); if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_head(); ?>

<?php if($bnews_options['enCufon'] == 1) { ?>
<script type="text/javascript">
<?php } ?>


<?php /* Define id number of current category for category based advertisement */
if(is_category() || is_single()) {
$category = get_the_category();
$currentcat = $category[0]->cat_ID;

<?php if($bnews_options['enable728'] == 1) { ?>
<div id="topad">
if(file_exists(TEMPLATEPATH . '/ads/sitewide_728x90/'.$currentcat.'.php') && (is_single() || is_category())) {
include_once(TEMPLATEPATH . '/ads/sitewide_728x90/'.$currentcat.'.php');
else {
include_once(TEMPLATEPATH . '/ads/sitewide_728x90.php');
<?php } ?>

<div id="wrapper">

<div id="navpages">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Nav_Pages') ) : ?>
<?php /* NAV MENU 1 */
if($bnews_options['ennav1'] == 1) {
wp_nav_menu( array('theme_location' => 'Header_Page_Nav', 'container' => false));
} else { ?>
<?php wp_list_pages('sort_column=menu_order&title_li=&exclude='.$bnews_options["excludePageNav"]); ?>
<li><a href="#" class="gab_connect"><?php _e('Stay Connected','Blognews'); ?></a>
<li><a class="gab_rss" href="<?php if ( $bnews_options["feedlink"] <> "" ) { echo $bnews_options["feedlink"]; } else { echo bloginfo('rss2_url'); } ?>" rel="nofollow" title="<?php _e('Subscribe to latest posts in RSS','Blognews'); ?>"><?php _e('Latest Posts in RSS','Blognews'); ?></a>
$categories = get_categories('hide_empty=1');
foreach ($categories as $cat)
echo '<li><a class="gab_rss" rel="nofollow" href="'.get_category_feed_link($cat->cat_ID, '').'">'. $cat->cat_name.'</a></li>';
<li><a class="gab_rss" href="<?php bloginfo('comments_rss2_url'); ?>" rel="nofollow" title="<?php _e('Subscribe to latest comments in RSS','Blognews'); ?>"><?php _e('Latest Comments in RSS','Blognews'); ?></a></li>
<?php if($bnews_options['enableMailSubscribe'] == 1) { ?><li><a class="gab_email" href="<?php echo $bnews_options["emailSubscribeLink"]; ?>" rel="nofollow" title="<?php _e('Subscribe to latest posts via email','Blognews'); ?>"><?php _e('Subscribe by e-mail','Blognews'); ?></a></li><?php } ?>
<?php if($bnews_options['enabletwitterUp'] == 1) { ?><li><a class="gab_twitter" href="http://www.twitter.com/<?php echo $bnews_options["twitterusername"]; ?>" rel="nofollow" title="<?php _e('follow on twitter','Blognews'); ?>"><?php _e('Follow us on Twitter','Blognews'); ?></a></li><?php } ?>
<?php if($bnews_options['enablefacebook'] == 1) { ?><li><a class="facebook.png" href="<?php echo $bnews_options["linktofacebook"]; ?>" rel="nofollow" title="<?php _e('Connect on facebook','Blognews'); ?>"><?php _e('Connect on Facebook','Blognews'); ?></a></li><?php } ?>
<?php } ?>
<?php endif; ?>

<div id="search">
<?php get_search_form(); ?>
</div><!-- /search -->
<div class="clear"></div>

<div id="header">

<?php if($bnews_options['headerimage'] == 1) { ?>
<a href="<?php bloginfo('url'); ?>" title="<?php bloginfo(description); ?>">
<img src="<?php echo $bnews_options["himageurl"]; ?>" style="maximum-width:970px;" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?>"/>
<?php } else { ?>

<div id="logo" style="padding:<?php echo $bnews_options["logoMarginTop"]; ?>px 0 0 <?php echo $bnews_options["logoMarginLeft"]; ?>px;">
<!-- LOGO -->
<!-- If display Image Logo is activated -->
<?php if($bnews_options['enableLogo'] == 1) { ?>
<a href="<?php bloginfo('url'); ?>" title="<?php bloginfo(description); ?>">
<img src="<?php echo $bnews_options["logoUrl"]; ?>" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?>"/>
<?php } ?>

<!-- If text is activated to be displayed as logo -->
<?php if($bnews_options['enableLogo'] == 0) { ?>
<a href="<?php bloginfo('url'); ?>" title="<?php bloginfo(name); ?>">
<?php echo $bnews_options["titleSiteNameFirstRow"]; ?>
<span><?php echo $bnews_options["titleSiteNameSecondRow"]; ?></span>
<?php } ?>
</div><!-- /logo -->

<div class="banner">
if(file_exists(TEMPLATEPATH . '/ads/sitewide_468x60header/'.$currentcat.'.php') && (is_single() || is_category())) {
include_once(TEMPLATEPATH . '/ads/sitewide_468x60header/'.$currentcat.'.php');
else {
include_once(TEMPLATEPATH . '/ads/sitewide_468x60header.php');
</div><!-- /banner -->
<?php } ?>
</div><!-- /header -->

<div class="clear"></div>

<div id="navcats">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Nav_Cats') ) : ?>
<?php /* NAV MENU 2 */
if($bnews_options['ennav2'] == 1) {
wp_nav_menu( array('theme_location' => 'Header_Category_Nav', 'container' => false));
} else { ?>
<li class="first<?php if(is_home() ) { ?> current-cat<?php } ?>"><a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('description'); ?>"><?php _e('Home','Blognews'); ?></a></li>
<?php wp_list_categories('orderby='.$bnews_options["orderBy"].'&order='.$bnews_options["order"].'&title_li=&exclude='.$bnews_options["excludeCategories"]); ?>
<?php } ?>
<?php endif; ?>

<div class="clear"></div>

<?php get_header(); ?>
<div id="primaryTopWrapper">
<div id="featuredContent">

<div id="featuredNav">
<div id="paginate-featured-slider"></div>
<span class="featuredViewAll"><a href="<?php echo get_category_link($bnews_options["featuredCatID"]);?>"><?php _e('View All','Blognews'); ?></a></span>
<div class="clear"></div>

<?php if (intval($bnews_options["feaPostCount"]) > 0 ) { ?>
<!-- featured entries -->
<div id="featured-slider" class="sliderwrapper">
$count = 1;
$gabquery = new WP_Query();$gabquery->query('showposts='.$bnews_options["feaPostCount"].'&cat='.$bnews_options["featuredCatID"]);
while ($gabquery->have_posts()) : $gabquery->the_post();
<div class="contentdiv">
<div class="sliderPostPhoto">

'name' => 'blgn-featured',
'enable_video' => '1',
'enable_thumb' => '1',
'media_width' => '480',
'media_height' => '270',
'thumb_align' => 'alignnone',
'enable_default' => '1',
'default_name' => 'featured.jpg'

<?php if (($gab_flv == '') and ($gab_video == '')) { ?>
<div class="sliderPostInfo">
<h2 class="featuredTitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php } ?>
</div><!-- end of sliderphoto/video -->

<!-- Slider Post Excerpt -->
<div class="featuredPost lastPost">
<?php if($bnews_options['enableAName'] == 1) { ?>
<span class="author"><?php the_author_posts_link(); ?></span>
<?php } ?>

<?php if($bnews_options['enableDate'] == 1) { ?>
<span class="date"><?php the_time($bnews_options["timeFormat"]); ?> | </span>
<?php } ?>

<?php print string_limit_words(get_the_excerpt(), 50); ?>&hellip;

<span class="featuredPostMeta">
<?php the_time($bnews_options["dateFormat"]); ?> / <?php comments_popup_link(__('No Comment','Blognews'), __('1 Comment','Blognews'), __('% Comments','Blognews'));?> / <a href="<?php the_permalink() ?>" rel="bookmark"><?php _e('Read More &raquo;','Blognews'); ?></a><?php edit_post_link(__('Edit','Blognews'),' / ',''); ?>
</div><!-- end of featuredpost (post excerpt) -->

</div><!-- end of contentdiv -->
<?php $count++; endwhile; wp_reset_query(); ?>
</div><!-- end of #featured-slider -->

<script type="text/javascript">
id: "featured-slider", //id of main slider DIV
contentsource: ["inline", ""], //Valid values: ["inline", ""] or ["ajax", "path_to_file"]
toc: "#increment", //Valid values: "#increment", "markup", ["label1", "label2", etc]
nextprev: ["<?php _e('Prev','Blognews'); ?>", "<?php _e('Next','Blognews'); ?>"], //labels for "prev" and "next" links. Set to "" to hide.
revealtype: "<?php if($bnews_options['revealtype'] == 1) { echo 'click'; } else { echo 'mouseover'; } ?>", //Behavior of pagination links to reveal the slides: "click" or "mouseover"
enablefade: [true, 0.4], //[true/false, fadedegree]


11-15-2010, 03:36 AM
<b>Fatal error</b>: Call to undefined function bloginfo() in <b>/data/20/2/10/40/2336692/user/2565619/htdocs/ep.php</b> on line <b>16</b><br />

LINE 16:

<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php if ( $bnews_options["feedlink"] <> "" ) { echo $bnews_options["feedlink"]; } else { echo bloginfo('rss2_url'); } ?>" />

11-15-2010, 04:15 AM
This is a wordpress template. Is your wordpress running ok?

11-15-2010, 04:45 AM
Its a wordpress template?

I heard it was but didnt understand wordpress.

What do i do from here for the wordpress template? I am lost

11-15-2010, 05:16 AM
This is what I meant by getting ahead of yourself. Wordpress is a blogging software/CSM.


Its kinda like tryin to use the internet without realizing you need need a modem. Wordpress is thankfully easy to setup, and themes are easy to install. But if you bought the template to use as a site template, you have A LOT of work to do.

11-15-2010, 12:57 PM
Ok, I downloaded that folder but where do i start off?

Do I use my dreamweaver?

11-15-2010, 01:30 PM
you should start wordpress installation.
just upload wordpress to your host and open your site. Wordpress will ask several questions and install itself, then
put your theme directory into /wp-content/themes/ and choose taht theme in admin account

11-15-2010, 02:22 PM
PM me about this.
More info on your webhost, and what your site is going to be about.

11-15-2010, 02:24 PM
installing wordpress isn't that hard usually, alot of hosts have 1 click installation with themes already installed all you gotta do is pick one and installing a theme isn't hard either if you've purchased a premade...I would invest in a host that has the 1 click installation since you are completly lost it'll save you alot of frustration and headaches and like you said money as well

11-15-2010, 05:31 PM
When i am looking your site it's display error like below

Fatal error: Call to undefined function bloginfo() in /data/20/2/10/40/2336692/user/2565619/htdocs/ep.php on line 16

bloginfo() is inbuilt wordpress function but it not call or find this function.

So please check you main folder in wordpress wp-load.php file is exists or not.
If it exists then include wp-load.php file in your ep.php file with correct path and then check it its included perfectly or not.

Hope your error is sorted after this.

11-15-2010, 07:21 PM
I will upload my wordpress files to my host. But what do I do because the host doesnt have any material on the supposive homepage, so how would uploading wordpress files make it different.

Also do I upload these in the >CGIBIN or >HTDOCS?
And if it is the HTDOCS folder (where i uploaded everything else page wise) do I make a folder in their called wordpress or just upload them?


(PS: The host is "Network Solutions" nsHosting Shared)

11-15-2010, 07:26 PM
upload to htdocs,
make sure you have wp-admin, wp-content, index.php and other files immediately in htdocs

then try to open your site. wordpress must invite you to start the installation

11-15-2010, 07:27 PM
Wait, quick question: do you have/have access to a database? If not, you're out of luck (I don't think WP has a flat-file setup).

If you do, you upload it to whatever your websites home directory is (or sub directory if you want it somewhere other then your home page), then just follow the instructions as listed on the WP website.

11-17-2010, 01:05 PM
There was a quick button to make a wordpress. I did that!

But after going to upload the .zip file "blognews" I got this message...

Warning: fopen(/data/20/2/10/40/2336692/user/2565619/htdocs/news/wp-content/themes/news/style.css) [function.fopen]: failed to open stream: No such file or directory in /data/20/2/10/40/2336692/user/2565619/htdocs/news/wp-includes/functions.php on line 3598

Warning: fread(): supplied argument is not a valid stream resource in /data/20/2/10/40/2336692/user/2565619/htdocs/news/wp-includes/functions.php on line 3601

Warning: fclose(): supplied argument is not a valid stream resource in /data/20/2/10/40/2336692/user/2565619/htdocs/news/wp-includes/functions.php on line 3604

It wont let me save the new theme... what should I do?

11-17-2010, 01:09 PM
If you look at http://0324e96.netsolhost.com/news/ there is an obvious problem with the new theme being activated. How should I fix these problems?

11-17-2010, 03:20 PM
OK ...
Let's go back a few squares ...

So you used the "quick button" to install WP.
At that point, did it open WP correctly, using it's default theme?
You were able to go into WP admin and everything works?

Then, after WP is working successfully, you want to install your own theme?

Is that what has happened so far?

11-17-2010, 04:01 PM
if you did the quick install its all gravy from here, go to yousite.com/wp-admin fill out all that stuff then go into log in with your ftp client go to wp-content directory click the theme folder next go get the theme you purchased and drop it in there after that go back to yoursite.com/wp-admin you should be at the dashboard go to appearance click themes and find your theme on there click activate it should work after that.. i dont know if uploading the .zip folder works i've never tried it but thats what I did for mysite which i'm making from scratch

11-17-2010, 04:13 PM
He should have unzipped the .zip file and uploaded the theme folder "intact", with all of it's sub-folders.

That gets uploaded into the "wp-content/themes" directory.

We'll see where he is at, and what transpired before this.

11-17-2010, 04:16 PM
thats what I'm saying thats the only way I learned how

11-17-2010, 04:30 PM
it all worked ok... then i uploaded the .zip file (compressed) and then it gave me the error. Before this point all of it worked and i had the generic blog page "welcome world"

11-17-2010, 04:56 PM
ok you gotta extract the .zip file follow the steps I showed in my last post and you should be alright after that

11-17-2010, 09:46 PM
Go into "wp-content/themes" and see how the other themes are done.

When you unzip your new theme, upload it the same way as the others.
The file and folder structure is the same as the default theme.

Go into admin under "appearances", and your new theme should be there.
Select your new theme.

11-18-2010, 03:29 AM
Guys, I uploaded the blog news file to the theme folder by .zip and then deleted that... and uploaded each one by hand in the folder.

Something is wrong with the template code.

I still get the same problem showing when I go to activate it, and when I activate it: the homepage gives me this same old b's

Fatal error: Call to undefined function add_custom_background() in /data/20/2/10/40/2336692/user/2565619/htdocs/news/wp-content/themes/blognews/functions.php on line 10

11-18-2010, 03:35 AM
This is the php code "function" file that is apparently wrong:


# This theme supports gettext
function theme_init(){
load_theme_textdomain('Blognews', get_template_directory() . '/languages');
add_action ('init', 'theme_init');

# This theme has support for custom background

#this theme support post thumbnails

#This theme supports custom navigation
if ( function_exists('wp_nav_menu') ) {
register_nav_menus( array(
'Header_Page_Nav' => __( 'Page list on header', 'Blognews' ),
'Header_Category_Nav' => __( 'Category navigation on header', 'Blognews' ),
) );

# Define Includes Path */
$gab_includes = TEMPLATEPATH . '/includes/';

# Load theme Javascripts into the wp_head
require_once ($gab_includes . 'theme-js.php');

# Register widget zones
require_once ($gab_includes . 'register-widget-zones.php');

# Theme Functions
require_once ($gab_includes . 'theme-functions.php');

# Theme Control Panel
require_once ($gab_includes . 'theme-control-panel.php');

# Load customized comments template
require_once ($gab_includes . 'theme-comments.php');

# Load theme thumbnails
require_once ($gab_includes . 'theme-thumbnails.php');

# Load theme variables
require_once ($gab_includes . 'theme-variables.php');