Jump to content

blog search


sudsy1970

Recommended Posts

Hi all,

 

I am trying to implement a search of a blog, using Object Oriented PHP, a concept which seems a little alien to me.

I have had an attempt at it but it doesn't seem to work, but am not really sure why.

 

I think that i have told the search on post to refer to the command BlogSearch and then within that command look for the titles of the blogs that are the same as the search and display them.

 

Any help greatly appreciated.

 

 

 

<?php
/*views/index.php*/

require_once("ViewHelper.php");

ViewHelper::DisplayHeader("Blog index");?>

<h1>Blog index</h1>

<p>You can <a href="index.php?cmd=BlogAddForm">add messages</a> !</p>

<form action="index.php?cmd=BlogSearch" method="post">
Search: <input name="search"> 
<input type="submit" value="Search!"> 
</form>

<?
foreach($data as $message)
echo("<div class=\"message\">
<h2>{$message['title']}</h2>
<p>{$message['message']}</p>
<a href=\"index.php?cmd=BlogDelete&id={$message['id']}\">Delete this message</a>
</div>");
?>

<?ViewHelper::DisplayFooter();?>

 

<?php


require_once("ViewHelper.php");

ViewHelper::DisplayHeader("Blog index");?>
<?
foreach($title as $search)
echo("<div class=\"message\">
<h2>{$message['title']}</h2>
<p>{$message['message']}</p>

</div>");
?>

<?ViewHelper::DisplayFooter();?>


?>

Link to comment
https://forums.phpfreaks.com/topic/217115-blog-search/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.