PHP Web Host - Quality Web Hosting For All PHP Applications Just Great Software
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
Author Message
sqzdog
Involved
Involved


Joined: Sep 22, 2003
Posts: 252

PostPosted: Fri Nov 07, 2003 7:54 pm Reply with quote Back to top

Would like to post a weekly photo in a block for our local dog pound. Can anyone tell me how to do this?
View user's profile Send private message Send e-mail
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Fri Nov 07, 2003 8:22 pm Reply with quote Back to top

Code:
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if (eregi("block-Picture_Block.php",$_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}

$content = "<center><img src=\"images/Wire-Fox-Terrier.jpg\" noborder></center>";

?>
Save the file to blocks/block-Picture_Block.php. You could also not make it a file and just make it an in-line block in the Block Administration panel. This assumes that images/Wire-Fox-Terrier.jpg is the location and name of your picture. You can, of course, add any valid options to the IMG tag.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
sqzdog
Involved
Involved


Joined: Sep 22, 2003
Posts: 252

PostPosted: Sat Nov 08, 2003 7:29 am Reply with quote Back to top

Ok, I got that working good. Thanks for the tip. Now, If I want to add some text below it, info about the animal, etc, with a link to the pound website, how is that done?
View user's profile Send private message Send e-mail
CodyG
Life Cycles Becoming CPU Cycles


Joined: Jan 02, 2003
Posts: 668
Location: Vancouver Island

PostPosted: Sat Nov 08, 2003 8:12 pm Reply with quote Back to top

try ...

Code:

if (eregi("block-Picture_Block.php",$_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}

$content = "<center><img src=\"images/Wire-Fox-Terrier.jpg\" noborder><br>this is some text</center>";


I love the way php and html work together. I guess it could be so elegant or it it could be a real plate of spagetti.
View user's profile Send private message
mikem
New Member
New Member


Joined: Sep 23, 2003
Posts: 15

PostPosted: Sat Nov 08, 2003 8:25 pm Reply with quote Back to top

Justa tip, but this nice little tool comes in handy by Disipal when making your own blocks and converting html to php.
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sat Nov 08, 2003 8:35 pm Reply with quote Back to top

Personally, I think those tools cause unnecessary overhead and confusion. It is much simpler and much more powerful to use the WHEREDOC syntax. That way, you don't have any quoting issues at all. You develop your html/css/javascript and get it working. Then, you simply drop it into the WHEREDOC block! And, you can use PHP variables too. What a bonus. So the code above becomes

$content = <<<_MYCODE_
<center><img src="images/Wire-Fox-Terrier.jpg" noborder><br>this is some text</center>
_MYCODE_;

Obviously a one line is not indicative of the savings. Search in my forums and at NC to see all my posts on WHEREDOC.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
CodyG
Life Cycles Becoming CPU Cycles


Joined: Jan 02, 2003
Posts: 668
Location: Vancouver Island

PostPosted: Sun Nov 09, 2003 11:04 am Reply with quote Back to top

exactly ... seems to me that overcoming the nuke learning curve for those who already do html is getting their html into the php. Had I known about WHEREDOC, (also HEREDOC?,
Only registered users can see links on this board!
Get registered or login to the forums!
), I would have saved myself a zillion hours.
View user's profile Send private message
sqzdog
Involved
Involved


Joined: Sep 22, 2003
Posts: 252

PostPosted: Sun Nov 09, 2003 11:32 am Reply with quote Back to top

I followed the original code that Cody G suggested and it worked great. I tried to place a link to this dog pound within the text and it wouldn't work. Here is an example:

Quote:

if (eregi("block-Picture_Block.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}

$content = "<center><img src=\"images/Wire-Fox-Terrier.jpg\" noborder><br>this is some text that includes a link<a href="http:dogpound.com">Dog Pound</a></center>";


It have me a parse error or something. It works fine as long as I don't try to put a link in the text. Any ideas?
View user's profile Send private message Send e-mail
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Nov 09, 2003 11:35 am Reply with quote Back to top

Quote:

$content = "<center><img src=\"images/Wire-Fox-Terrier.jpg\" noborder><br>this is some text that includes a link<a href="http:dogpound.com">Dog Pound</a></center>";
You have not escaped quotes w/i quotes with a \ . Try this
Code:
$content = "<center><img src=\"images/Wire-Fox-Terrier.jpg\" noborder><br>this is some text that includes a link<a href=\"http:dogpound.com\">Dog Pound</a></center>";
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
CodyG
Life Cycles Becoming CPU Cycles


Joined: Jan 02, 2003
Posts: 668
Location: Vancouver Island

PostPosted: Sun Nov 09, 2003 11:53 am Reply with quote Back to top

It is that annoying escaping quotes that makes Raven's solution so elegant. Do try Raven's idea too.
View user's profile Send private message
sqzdog
Involved
Involved


Joined: Sep 22, 2003
Posts: 252

PostPosted: Sun Nov 09, 2003 1:22 pm Reply with quote Back to top

No, because I have no idea what that is. Is it a program or something?
View user's profile Send private message Send e-mail
sqzdog
Involved
Involved


Joined: Sep 22, 2003
Posts: 252

PostPosted: Sun Nov 09, 2003 7:40 pm Reply with quote Back to top

OK, Cody I tried your script above, but the link when clicked, takes me to
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Send e-mail
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Nov 09, 2003 7:43 pm Reply with quote Back to top

I never noticed that you still have a syntax error in your code. You have http:dogpound.com

it should be
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
sqzdog
Involved
Involved


Joined: Sep 22, 2003
Posts: 252

PostPosted: Sun Nov 09, 2003 7:45 pm Reply with quote Back to top

oh, yes it does have the // in it.

Quote:
Only registered users can see links on this board!
Get registered or login to the forums!

View user's profile Send private message Send e-mail
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Nov 09, 2003 7:48 pm Reply with quote Back to top

Well, it doesn't in any of your previous posts so that seemed like an obvious one. If it does and this is your code, it should work
Code:
$content = "<center><img src=\"images/Wire-Fox-Terrier.jpg\" noborder><br>this is some text that includes a link<a href="http://dogpound.com">Dog Pound</a></center>";
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
sqzdog
Involved
Involved


Joined: Sep 22, 2003
Posts: 252

PostPosted: Sun Nov 09, 2003 8:12 pm Reply with quote Back to top

Here is the entire code. It still ain't working.

Quote:

if (eregi("block-Picture_Block.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}

$content = "<center><img src=\"images/spca.jpg\" noborder><br><b>Patches</b>, a golden lab X, female, about 2.5 years old and weighs about 45 lbs.<br>Visit the<a href="http://cstone.net/~fspca">Fluvanna SPCA</a></center>";

?>
View user's profile Send private message Send e-mail
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Nov 09, 2003 8:14 pm Reply with quote Back to top

You still have not entered your quotes w/i quotes Rolling Eyes

All quotes w/i quotes MUST be prefaced with a \
Code:
$content = "<center><img src=\"images/spca.jpg\" noborder><br><b>Patches</b>, a golden lab X, female, about 2.5 years old and weighs about 45 lbs.<br>Visit the<a href=\"http://cstone.net/~fspca\">Fluvanna SPCA</a></center>";
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
sqzdog
Involved
Involved


Joined: Sep 22, 2003
Posts: 252

PostPosted: Sun Nov 09, 2003 8:19 pm Reply with quote Back to top

Great, now i get what you mean about the within quotes having the \

Thanks Gaylen
View user's profile Send private message Send e-mail
sqzdog
Involved
Involved


Joined: Sep 22, 2003
Posts: 252

PostPosted: Sun Nov 09, 2003 9:49 pm Reply with quote Back to top

Fixed, thanks!
View user's profile Send private message Send e-mail
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum