Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 21:16

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[PHP] PHP-If Frage

Discussion on [PHP] PHP-If Frage within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 8
Join Date: Jul 2010
Posts: 570
Received Thanks: 141
[PHP] PHP-If Frage

Guten Abend, liebe e*pvp Community
ich hätte da eine Frage und zwar würde ich gerne zuerst den Post Titel mit "get_the_title" rausfinden (Wordpress) anschliessend will ich aus dem was herauskommt Testen ob z.B. Hallo in dem Post Titel enthalten ist und wenn es enthalten ist soll er ein Bild platzieren. Habe schon viel versucht, bin aber noch relativ neu in sowelchen Sachen...
.SweeT is offline  
Old 07/08/2011, 16:37   #2
 
NotEnoughForYou's Avatar
 
elite*gold: 0
Join Date: Jun 2010
Posts: 3,406
Received Thanks: 2,024
PHP Code:
<?php
$hallo 
mysql_real_escape_string($_POST['get_the_title']);

if(
$hallo == "hallo") and (!empty($hallo)) {
echo
' <img src="blabla" />';
}
?>
habe mal angenommen dass es ein formular ist und get the title der name von einem input
NotEnoughForYou is offline  
Old 07/08/2011, 18:35   #3
 
elite*gold: 8
Join Date: Jul 2010
Posts: 570
Received Thanks: 141
Quote:
Originally Posted by NotEnoughForYou View Post
PHP Code:
<?php
$hallo 
mysql_real_escape_string($_POST['get_the_title']);

if(
$hallo == "hallo") and (!empty($hallo)) {
echo
' <img src="blabla" />';
}
?>
habe mal angenommen dass es ein formular ist und get the title der name von einem input
get_the_title ist eine Function ^^
.SweeT is offline  
Old 07/09/2011, 10:46   #4
 
elite*gold: 0
Join Date: Oct 2008
Posts: 319
Received Thanks: 88
Ich kenn mich mit Worpress leider nicht aus, ich geh einfach mal davon aus
das get_the_title() einfach nen String zurückgibt oder?

PHP Code:
echo (stripos(get_the_title()), 'hallo') === true) ? '<img src="bild" />' '' 

Fratyr is offline  
Reply




All times are GMT +1. The time now is 21:18.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.