View previous topic :: View next topic |
Author |
Message |
Doctor Feelgood Arrrrghh!
Joined: 07 Apr 2003 Posts: 20349 Location: New Jersey
|
|
Back to top |
|
|
Little Bruin
Boo Boo
Joined: 07 Apr 2003
Posts: 667
Location: Pic-A-Nic Basket |
|
|
IceNine *The Freshest*
Joined: 08 Sep 2003 Posts: 1459 Location: Bel Air
|
Posted: Tue, 21 Dec 2004 13:08:45 Post Subject: |
|
|
You mean if you had in "example.html":
And that was included in another file? Is that about what you mean? _________________
A letter to a soldier |
|
Back to top |
|
|
Doctor Feelgood Arrrrghh!
Joined: 07 Apr 2003 Posts: 20349 Location: New Jersey
|
|
Back to top |
|
|
IceNine *The Freshest*
Joined: 08 Sep 2003 Posts: 1459 Location: Bel Air
|
Posted: Tue, 21 Dec 2004 14:37:29 Post Subject: |
|
|
I guess I'm sort of confused (sorry). Could you give me a real world example? You could email it to me if neccessary. _________________
A letter to a soldier |
|
Back to top |
|
|
Doctor Feelgood Arrrrghh!
Joined: 07 Apr 2003 Posts: 20349 Location: New Jersey
|
Posted: Tue, 21 Dec 2004 14:44:39 Post Subject: |
|
|
I don't have anything to e-mail you really... just trying to figure this out.
But basically say:
example.html has
$title = 'monkey';
I want index.php (for example) to be able to reference example.html so when I <?php echo $title; ?> in index.php, it knows that it is "monkey"!
|
|
Back to top |
|
|
IceNine *The Freshest*
Joined: 08 Sep 2003 Posts: 1459 Location: Bel Air
|
Posted: Tue, 21 Dec 2004 15:03:23 Post Subject: |
|
|
Do you include "example.html" before you echo the title? You could do it a couple ways:
preg_match() it, finding a special tag - not $title = 'monkey' but something like <title>monkey</title>
Or you could change example.html into example.php and in one small spot, just to <?$title = 'monkey'; ?> and the variable would be set. _________________
A letter to a soldier |
|
Back to top |
|
|
Doctor Feelgood Arrrrghh!
Joined: 07 Apr 2003 Posts: 20349 Location: New Jersey
|
|
Back to top |
|
|
Little Bruin
Boo Boo
Joined: 07 Apr 2003
Posts: 667
Location: Pic-A-Nic Basket |
|
|
IceNine *The Freshest*
Joined: 08 Sep 2003 Posts: 1459 Location: Bel Air
|
Posted: Tue, 21 Dec 2004 15:18:16 Post Subject: |
|
|
When you include something like that, it will output all HTML as well. If you're just trying to extract the title, you'll have to do a file_get_contents instead of an include. But then you'll have to use preg_match. _________________
A letter to a soldier |
|
Back to top |
|
|
Doctor Feelgood Arrrrghh!
Joined: 07 Apr 2003 Posts: 20349 Location: New Jersey
|
Posted: Tue, 21 Dec 2004 15:34:37 Post Subject: |
|
|
OK... have a basic example of the use of preg match?
thanks man!
|
|
Back to top |
|
|
IceNine *The Freshest*
Joined: 08 Sep 2003 Posts: 1459 Location: Bel Air
|
Posted: Tue, 21 Dec 2004 15:39:16 Post Subject: |
|
|
Code: | preg_match("/<title>(.*)<\/title>/i", $html_content, $match); |
It creates the variable $match, which is an array. The title will be in $match[0] _________________
A letter to a soldier |
|
Back to top |
|
|
|