im trying to develop a shortcode replacer but can't really get the hang of it. What i want to do is that the user can write something like [slideshow]10[/slideshow] and then make so slideshow with id number 10 appears. This is as far as i've come:
$slideArray = array(preg_match_all('/\[slideshow\](.*?)\[\/slideshow\]/is', $post, $matches));
With this i then:
for ($o = 0; $o <= $count; $o++)
{
$query = mysql_query("SELECT * FROM slideshow WHERE id = ''. $matches[1][$o]. '' LIMIT 1");
while ($row = mysql_fetch_assoc($query))
{
// Slideshow code appears here
}
}
This works but now i have to decide if the slideshow appears in the top of the post or the bottom. But if i want to make so this slideshow appears where the user has written it. So it would be possible that it appears for an example in the middle of the text. Then is it possible to create function of this and then use preg_replace to replace [slideshow]10[/slideshow] with the query code above. I'm sorry for my poor english.
Best Regards