I've made a small search function as of here:
if (stristr($bleh, $search_for)) {
if(preg_match('/<title>([^<]*)<\/title>/i', $bleh, $matches))
{
$name = str_replace("./","/",$name);
echo "<li><a href=$link".$na me.">".$matche s[1]."</a><br><br>";
}
Now this actually works fine, and gives me a page link and title of a
page, based on pages that contain the search term.
Im now trying to rationalise the code a bit more, so that the order of
the links depends on how many times that certain word appears on the
page.
Any ideas please?
My understanding is that i need to somehow count how many times the
$search_for text appears in the $bleh text, and then move onto the next
page. 3 2339
On 26 Oct 2006 02:41:00 -0700, "Advo" <ma**********@h otmail.com>
wrote:
>I've made a small search function as of here:
if (stristr($bleh, $search_for)) { if(preg_match('/<title>([^<]*)<\/title>/i', $bleh, $matches)) { $name = str_replace("./","/",$name); echo "<li><a href=$link".$na me.">".$matche s[1]."</a><br><br>";
}
Now this actually works fine, and gives me a page link and title of a page, based on pages that contain the search term.
Im now trying to rationalise the code a bit more, so that the order of the links depends on how many times that certain word appears on the page.
Any ideas please?
My understanding is that i need to somehow count how many times the $search_for text appears in the $bleh text, and then move onto the next page.
http://us2.php.net/manual/en/function.substr-count.php
Tyrone Slothrop wrote:
On 26 Oct 2006 02:41:00 -0700, "Advo" <ma**********@h otmail.com>
wrote:
>>I've made a small search function as of here:
if (stristr($bleh, $search_for)) { if(preg_match ('/<title>([^<]*)<\/title>/i', $bleh, $matches)) { $name = str_replace("./","/",$name); echo "<li><a href=$link".$na me.">".$matche s[1]."</a><br><br>";
}
Now this actually works fine, and gives me a page link and title of a page, based on pages that contain the search term.
Im now trying to rationalise the code a bit more, so that the order of the links depends on how many times that certain word appears on the page.
Any ideas please?
My understanding is that i need to somehow count how many times the $search_for text appears in the $bleh text, and then move onto the next page.
http://us2.php.net/manual/en/function.substr-count.php
Oh Tyrone, that guy is having a great time with regex, and now you spoiled
all the fun with an easy ready-to-go built-in function. :P
Erwin
Erwin Moller wrote:
Tyrone Slothrop wrote:
On 26 Oct 2006 02:41:00 -0700, "Advo" <ma**********@h otmail.com>
wrote:
>I've made a small search function as of here:
if (stristr($bleh, $search_for)) { if(preg_match( '/<title>([^<]*)<\/title>/i', $bleh, $matches)) { $name = str_replace("./","/",$name); echo "<li><a href=$link".$na me.">".$matche s[1]."</a><br><br>";
}
Now this actually works fine, and gives me a page link and title of a page, based on pages that contain the search term.
Im now trying to rationalise the code a bit more, so that the order of the links depends on how many times that certain word appears on the page.
Any ideas please?
My understanding is that i need to somehow count how many times the $search_for text appears in the $bleh text, and then move onto the next page.
http://us2.php.net/manual/en/function.substr-count.php
Oh Tyrone, that guy is having a great time with regex, and now you spoiled
all the fun with an easy ready-to-go built-in function. :P
Erwin
err no.. what he gave me does aditional tasks to what the code i pasted
does. the code i pasted also works 100% as expected, and as needed.
the code i am after and looking towards will add to this existing code,
not replace it. thanks then This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: cassandra.flowers |
last post by:
Hi,
I have another string handling question for the group, since you have all
been so helpful in the past. Thank you.
Basically, I want to do something really simple:
Search a main string for a substring, then count how many times the
|
by: Glenn Cornish |
last post by:
I have 5 fields in a table into which numbers between 1 and 45 can be
entered. What I am having trouble with is being able to find out is how
many times a particular number appears, regardless of which of the 5 fields
it was entered into. Can anyone suggest a remedy for this.
Many Thanks
Glenn
|
by: Ralph Noble |
last post by:
Does anyone know of a string function in Access that will allow me to
count the number of instances one string occurs within another? Or if
there is some sort of word count function? If there is, I'm not aware
of it. I've tried the following unsuccessfully ...
SELECT *, (Len()-Len(Replace(,'
what_im_looking_to_count','')))/(Len(' what_im_looking_to_count')) AS
KeywordFoundCountFROM tblYourTable;
That'll find how many times the phrase...
|
by: sathyashrayan |
last post by:
Group,
Following function will check weather a bit
is set in the given variouble x.
int bit_count(long x)
{
int n = 0;
/*
** The loop will execute once for each bit of x
set,
|
by: j |
last post by:
Hi,
I've been trying to do line/character counts on documents that are
being uploaded. As well as the "counting" I also have to remove
certain sections from the file.
So, firstly I was working with uploaded MS WORD .doc files. Using code
like that below:
strLine = sr.ReadLine
While Not IsNothing(strLine) 'Not eof
If Trim(strLine) <> "" Then 'Not blank
| |
by: Al |
last post by:
Can anyone tell me if there's a way to return the amount
of times a button is "clicked"
I need to change text in a text box and that text changes
each time the button is clicked-up to 6 times with 6
different text values.
Thanks in anticipation.
Al@n
|
by: slacker |
last post by:
I have to write a program that reads in a text file word by word and calculates how many times each word appears in the file.
* I have to use dynamic array of pointers to structures to accumulate the word count (my initial thought is to take the entire file, exclude all punctuation and whitespace, and take each word and put it into an array)
* I can't include punctuation as part of the word, if I have a word like "hello!" it should be put...
|
by: bigbagy |
last post by:
Notes
The programs will be compiled and tested on the machine which runs the
Linux operating system. V3.4 of the GNU C/C++ compiler (gcc ,g++) must be used.
A significant amount coding is needed for this assignment.
1.Counting Words in C++
Problem: Write an elegant C++ program to count the number of times each word occurs
in a file. A word is defined as a sequence of characters surrounded by whitespace. Case is
not important, so...
|
by: sandvet03 |
last post by:
Im a newby to programing 2 months exp.. I am trying to write code in C to take a input string from the user and then the input substring. I wish to compare the substring to the string and count the number of times it apears and print this to the user. After many hours of frustration i have gotten this far any help or derection would be aprieciated
# include<stdio.h>
# include<math.h>
# include<stdlib.h>
# include<string.h>
int...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |