1

We are currently building a mobile website using Jquery Mobile (1.1.0) and are using a multi-page template. We are using PHP to call MYSQL for dynamic content and have hit a brick wall with a certain object. When trying to call a simple image, it will not display. In viewing the source, it shows the correct image file name, however, it does not display. When removing Jquery Mobile, the image returns fine so I'm positive our variable is correct.

The code below is basically what we are using to call and echo out. ($data is an array with the page detail).

<div data-role="page" id="page">

<div data-role="header" data-position="fixed" class="header">
<div> PHONE NUMBER GOES HERE</div>
</div>

<div data-role="content">

    <div class="logo">
            <a href="index.php" title="#"><img src="img/logo.png" /></a>
    </div>

        <h1>Page Title</h1>
        <p>:: <span><?php echo $data['img']; ?></span> :: </p>
    </div>
</div>      

As stated previously, this code produces results in the page source but on the actual page it outputs <span> :: :: </span>. If anyone can help it would be much appreciated.

2
  • What is the result you see when you view source? Commented Jun 26, 2012 at 20:56
  • There seems to be an extra </div> closing tag. Commented Jun 26, 2012 at 20:57

2 Answers 2

2

try:<img src="image_location/<?php echo '.$data['img'].'; ?>"/>

Sign up to request clarification or add additional context in comments.

Comments

0

Place the PHP code inside

<div data-role="page" id="page">
// php code here
<!-- All the HTML goes here -->
</div><!-- End of #page -->

Its needed as the page content is loaded using jQuery AJAX call. In that case whatever code is there outside <div data-role="page" id="page"> will not get executed in the AJAX call.

3 Comments

huh? if the ajax calls a .php it will be parsed.. i dont think this is correct. The front end does not parse PHP.
@j_mcnally The href of the button should be a PHP file. Then it does. Not inside an HTML file.
Thank you for the replies. The PHP code is inside the data-role div and therefore I'm unsure where it may be failing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.