PDA

View Full Version : PHP (Get Help!)


Gr_
29th September 2008, 06:32 PM
So people have been asking me a lot about PHP and for help with certain things they are working on. So I've decided to make this thread for people with any PHP questions or PHP code problems to post them to get answers.

What I would ask is that all code posted be put in code tags ie

[ code ]<?php print"Hello"; ?>[ /code ]
<?php print"Hello"; ?>

without the spaces and I will answer any problems you may have. I will test this for PHP first and if it works I'll start an HTML and CSS help thread.

Thanks.

tim|away
30th September 2008, 01:50 AM
I think it would be even more convenient if the code was pasted within php tags, as it has a syntax highlighting feature.

your code goes here


<?php
header("Location: ".$_SERVER['PHP_SELF']);
exit();
?>

Gr_
30th September 2008, 03:18 AM
Didn't even know they exsisted. :)

Red Dragon
6th October 2008, 01:23 AM
I am looking at doing 2 things with my site:

I am glad you make this post. I am trying to add social bookmarking to my users blog section. Digg, Del.ic.ious, Technorati, ect. with their logo. Where users can click the icon and sumbit the blog to these

I know how to do this with html, but my blogs page is done in php

Any tips, where to start, what do you need from me

==================================

The other thing is my forum doesn't keep track of post counts, I would like to script something for that, but will do one thing at a time.

==================================

I am pretty sure I am editing the correct bit of code to add the social bookmarking features, but everytime I get an error saying the header information has already been sent. And the social bookmarks end up in the header

existing code

$_ni = $_page['name_index'];
$_page_cont[$_ni]['page_main_code'] = PageCompBlogs();
$_page['extra_js'] = $oTemplConfig -> sTinyMceEditorJS;
$_page['header'] = $oBlogs->GetHeaderString();
$_page['header_text'] = $oBlogs->GetHeaderString();

function PageCompBlogs() {
global $site;
global $date_format;
global $oBlogs;

$sRetHtml = '';
$sRetHtml .= $oBlogs->GenCommandForms();



This is what I am adding to the code

$tag = "Connection Square User Blog";
$tag = urlencode($tag);
$url = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
$url = urlencode($url);
echo <<<EOD
<a href="http://www.socialize-it.com/index.php?url=$url&tag=$tag">Automatic Social Bookmarking<br> <img src="http://www.socialize-it.com/socializeit.png" alt="socialize it"></a>
EOD;

Gr_
6th October 2008, 06:19 AM
Much simplar would be using the html that works an echoing it using php. do you have the html code?

Red Dragon
6th October 2008, 12:51 PM
This is the html that the page calls (page_49.html)

__include _header.html__
<div class="clear_both"></div>
__page_main_code__
__include _footer.html__


Then I have this in the blogs.phpfile

$_page['name_index'] = 49;
$_page['css_name'] = 'blogs.css';