[Help][Request][HTML][PHP][SMF][000WebHost] - Custom Page Coding Integration

Posts 1–9 of 9 · Page 1 of 1
[Help][Request][HTML][PHP][SMF][000WebHost] - Custom Page Coding Integration
Hello forum members I need some help on some custom page coding integration I want to be able to have both html and php, but when I add my html with echo ' Html here '; it puts everything I did in the top corner I'm not sure if it's a CSS problem or my coding. I'm trying to add a whole bunch of PayPal donation buttons, also this is a custom page, but It's linked into index.php
I assume it's a css 'problem'. Basically you can't just 'echo' the info at the beginning of the web-page file and expect it to know where to go. Inside each <div ***> you will put the appropriate
<?php
echo 'myhtmlhere' . etc . etc ;
?>

So, your web-page code basically looks like this?

...
<div id="donations_section">
<div id="DonationMineCraft">
lotsoftextgoeshere
</div>
<div id="Donati********3d">
lotsoftextgoeshere
</div>
</div>

kind-of? Did you make it a php page (ie. opens with a <?php tag, or html ie <html>) ? If it's a html page w/ php inserted, just add..

<div id="donations_section">
<div id="DonationMineCraft">
<?php
echo'lotsoftextgoeshere'
?>
</div>
<div id="Donati********3d">
<?php
echo'lotsoftextgoeshere'
?>
</div>
</div>

^^ Of course if you're already in a php block don't put the extra <?php ?> 's.

Or, I'm not sure what you mean exactly. If you upload the page's source (..take out any 'sensitive' parts as needed ofc) maybe to something like pastebin or even here using the

[ code ]
[ /code ] tags. (take out the extra spaces)

I'll look at it.
Donatemc.php
Code:
<?php
 
if (!defined('SMF'))
	die('Hack Attempt...');

function DonatemcMain()
{

	global $context, $scripturl, $txt, $smcFunc;

	loadTemplate('Donatemc');

	$context['page_title'] = $txt['donatemc_PageTitle'];
	$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title']));


	$context['linktree'][] = array(
  		'url' => $scripturl. '?action=donatemc',
 		'name' => 'Donation (Minecraft)',
	);
	$context['donatemc_Head'] = 'Donation (Minecraft)';
	$context['donatemc_Body'] = 'Hello World!';
}
echo '
Paypal Button Code Here
Paypal Button Code Here
Paypal Button Code Here
Paypal Button Code Here
Paypal Button Code Here
Paypal Button Code Here
Paypal Button Code Here
Paypal Button Code Here
';


?>
Donatemc.template.php
Code:
<?php

function template_main()
{

	global $context;

	// Catbg header
	echo '<div class="cat_bar">
   			<h3 class="catbg">', $context['donatemc_Head'], '</h3>
	</div>';

	// Windowbg2 Content
	echo '<div class="windowbg2">
  			<span class="topslice"><span></span></span>
  		  		<div class="content">', $context['donatemc_Body'], '</div>
  			<span class="botslice"><span></span></span>
	</div><br />';

}

?>
What about index.php ...
These are all the pages I edited for my custom page.
index.php...
Code:
	// Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
	$actionArray = array(
		// Start Custom Home Action
		'home' => array('Home.php', 'HomeMain'),
		// End Custom Home Action
		// Start Custom Donation (Minecraft) Action
		'donatemc' => array('Donatemc.php', 'DonatemcMain'),
		// End Custom Donation (Minecraft) Action
Index.english.php...
Code:
$txt['message_index'] = 'Message Index';
$txt['news'] = 'News';
$txt['forums'] = 'Forums';
$txt['home'] = 'Home';
$txt['donatemc'] = 'Donatemc';
Modification.english.php...
Code:
// Start Custom Donation (Minecraft) Action
$txt['donatemc'] = 'Donatemc';
$txt['donatemc_PageTitle'] = 'Website Name Here - Donation (Minecraft)';
// End Custom Donation (Minecraft) Action
Who.english.php...
Code:
// Start Custom Donation (Minecraft) Action
$txt['whoall_donatemc'] = 'Viewing <a href="' . $scripturl . '?action=donatemc">Index Title</a>.';
// End Custom Donation (Minecraft) Action
Subs.php...
Code:
			'donatemc' => array(
				'title' => 'Server',
				'show' => true,
				'sub_buttons' => array(
					'donatemc' => array(
						'title' => 'Donate (Minecraft)',
						'href' => $scripturl . '?action=donatemc',
						'show' => true,
					),
					'votemc' => array(
						'title' => 'Vote (Minecraft)',
						'href' => $scripturl . '?action=votemc',
						'show' => true,
					),
					'donaters' => array(
						'title' => 'Donate (soon)',
						'href' => $scripturl . '?action=soon',
						'show' => true,
					),
					'voters' => array(
						'title' => 'Vote (soon)',
						'href' => $scripturl . '?action=soon',
						'show' => true,
					),
				),
			),
Is this copied from a public code base or did you write it all yourself?

I don't do php very often, but I fail to see how all the code you posted == the picture in your original post (minus css of course) ?

I was expecting something like..
index.php
Code:
<html>
....
<body>
<div id="main_container">
<div id="more_divs">
...
 <?php
   echo "<hr>This is from echo1. Copy?<hr>";
   // include("...") maybe?
  ?>
</div>
<div id="etc_etc">
...
 <?php
   echo "<hr>This is from echo2. Copy?<hr>";
   //include("..") maybe?
  ?>
</div>
...
</div> //main_container
</body>
</html>
^^Obviously not structured exactly like that.

I'm not sure.
Looks like a template fail

What about:
Donatemc.php:
Code:
<?php

function template_main()
{

	global $context;

	// Catbg header
	echo '<div class="cat_bar">
   			<h3 class="catbg">'.$context['donatemc_Head'].'</h3>
	</div>';

	// Windowbg2 Content
	echo '<div class="windowbg2">
  			<span class="topslice"><span></span></span>
  		  		<div class="content"><ul><li>'.$context['donatemc_Body'].'</li><li>'.$context['donatemc_Button'].'</li></ul></div>
  			<span class="botslice"><span></span></span>
	</div><br />';

}

?>
Donatemc.template.php:
Code:
<?php
 
if (!defined('SMF'))
	die('Hack Attempt...');

function DonatemcMain()
{

	global $context, $scripturl, $txt, $smcFunc;

	loadTemplate('Donatemc');

	$context['page_title'] = $txt['donatemc_PageTitle'];
	$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title']));


	$context['linktree'][] = array(
  		'url' => $scripturl. '?action=donatemc',
 		'name' => 'Donation (Minecraft)',
	);
	$context['donatemc_Head'] = 'Donation (Minecraft)';
	$context['donatemc_Body'] = 'Hello World!';
  $context['donatemc_Button'] = 'PAYPAL BUTTON CODE';
}

?>
CSS:
Code:
.content ul {
width: 100%;
}

.content ul li {
width: 50%;
display: inline-block;
float: left;
}
Thank you @Splak, and thank you @abuckau907
I noticed when I put in the CSS code it messed up the layout and moved everything around so I took the CSS code out and it looks perfect just one thing how do I get rid of the bullet next to everything?
Oh well I'm sorry.
Than only add this to your css code:
Code:
.content ul li {
list-style-type: none;
}
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?