Converting an html file to fit into wordpress

3 replies
  • WEB DESIGN
  • |
I found a script I want to insert on a wp page, but it's in a full html page.
Which sections do I cut out to make this file work correctly?

The following is from the .php example file.
-----

<?php
include('scripts/linkpopularity.class.php');
$linkpop = New LinkPOP();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>Check your Link Popularity</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="scripts/style.css" rel="stylesheet" type="text/css" />
</head>
<body >

<div id="container">
<div id="main">
<p>Once submitted, please be patient as this process can take upto 30 seconds.</p>
<form id="frm" method="post" action="<?= $PHP_SELF; ?>">
<input type="hidden" name="mr" value="<?= $today_date; ?>" />
<table cellpadding="0" cellspacing="0">
<tr>
<td width="1">http://</td>
<td width="1"><input id="url" class="check_box" type="text" name="url" value="ex: www.yourdomain.com" onfocus="value = '';" /></td>
<td width="1" class="button"><input type="submit" style="height: 20px;" class="check_button" value="submit" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="4" class="engines">
<input type="checkbox" name="engines[]" value="google" checked="checked">Google
&nbsp;&nbsp;<input type="checkbox" name="engines[]" value="bing" checked="checked">Bing
&nbsp;&nbsp;<input type="checkbox" name="engines[]" value="yahoo" checked="checked">Yahoo
&nbsp;&nbsp;<input type="checkbox" name="engines[]" value="alltheweb" checked="checked">AlltheWeb
&nbsp;&nbsp;<input type="checkbox" name="engines[]" value="altavista" checked="checked">Altavista
&nbsp;&nbsp;<input type="checkbox" name="engines[]" value="ask" checked="checked">Ask
&nbsp;&nbsp;<input type="checkbox" name="engines[]" value="alexa" checked="checked">Alexa Rating
&nbsp;&nbsp;<input type="checkbox" name="engines[]" value="dmoz" checked="checked">DMOZ
</td>
</tr>
</table>
</form>




<?php
if (isset($_POST['url']) && $_POST['url'] != "" )
{
$linkpop->allowed_engines = $_POST['engines'];
$linkpop->GetData($_POST['url']);
?>
<h2>Your Link Popularity results</h2>
<table cellspacing="0" cellpadding="0" id="linkpop">
<tr class="subtitle" >
<td colspan="10"><?=$linkpop->domain; ?></td>
</tr>

<tbody>
<tr class="engine-bar">
<?php
foreach($linkpop->results as $subdata)
{
print '<td>'.$subdata['name'].'</td>';
}
?>
</tr>

<tr class="result-line">
<?php
foreach($linkpop->results as $subdata)
{
?>
<td>
<?php
if (is_numeric($subdata['value'])){
echo '<span class="result-value">'.number_format($subdata['value'],0,'.',',').'</span>';
} else {
echo '<span class="result-value">'.strtolower($subdata['value']).'</span>';
}
if ($subdata['name'] != 'invalid url'){
print '<br><a class="check" href="'.$subdata['url'].'">(check)</a>';
}
?>
</td>
<?php
}
?>
</tr>

<?php
if (is_array($linkpop->directories))
{
?>

<?php
foreach($linkpop->directories as $subdata)
{
?>
<tr>
<td><?=$subdata['name']; ?></td>
<td style="text-align: right; padding-right: 3px;">
<?php
if (is_numeric($subdata['value'])) { echo number_format($subdata['value'],0,'.',',');
} else { echo strtolower($subdata['value']); }
?>
<a href="<?=$subdata['url']; ?>">(check)</a></td>
</tr>
<?php
}
}
?>
</tbody>
<tr class="total">
<td>Total</td>
<td style="text-align: right;"><?=number_format($linkpop->total,0,'.',','); ?></td>
<td colspan="10">&nbsp;</td>
</tr>
<?
}
?>

<tr>
<td colspan="10" style="margin-left:115px;"><span style="font-size:10px;">Powered by </span><a href="http://www.siteexpert.net/" target="_blank" style="font-size:10px; color:#666666;">Site Expert</a></td>
</tr>
</table>

</div>
</div>
</body>
</html>
#converting #file #fit #html #php #wordpress
  • Profile picture of the author BabBarDeL
    All before <body> and all after </body>.
    Signature
    {{ DiscussionBoard.errors[1554921].message }}
    • Profile picture of the author Aronya
      Originally Posted by BabBarDeL View Post

      All before <body> and all after </body>.
      Um... No. I don't think that's going to be very helpful.

      LP,
      I'm assuming that the linkpop script is what you're trying to use in WP. I don't know what it does, so I don't know if you want it on every page of your blog, so exactly where you're going to put it is something you'll have to figure out.

      But, if you want it on every page, you'll need to add it to either the header or footer files, or whatever file is used to create new pages/posts (different themes can use different file names).

      I think you could safely put the include statement you posted in the header file. You'll have to get additional input from someone else who understands the script and/or PHP better than I do to make everything work, but hopefully this is enough info to give you the gist of it.

      The files to edit will be found from your WP dashboard, in the Appearance section. Look for the Editor option and you'll find all of the theme pages.

      Hope that helps.
      {{ DiscussionBoard.errors[1556497].message }}
      • Profile picture of the author DarrenHill
        Not 100% sure with Wordpress but I think you could create a custom page template with the code and use that in your blog

        try reading here Pages WordPress Codex

        see if that helps

        I have done this in some other CMS's but as I said not sure about Wordpress

        Darren
        {{ DiscussionBoard.errors[1557654].message }}

Trending Topics