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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.