0

hrllo大家,我面临一个问题

我有一个 .php 文件,其中 img src 是这样的

<img src="images/1.jpg" />

我想这样改变

<img src="<?php echo base_url();?>application/admin/views/newsletter/126hfuueye_newsletter-1/images/1.jpg" />

这是我的 php 页面

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <?php
    $my_newsletter=$this->autoload_model->get_data_from_table('td_newsletter','*',"newsletter_id = '$newsletter_id'")->result_array();
    $bodytag = str_replace("%images/%", base_url().'application/admin/views/newsletter/'.$my_newsletter[0]['newsletter_title'].'/images/', "%images/%");

    ?>
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta content="telephone=no" name="format-detection" />
    <title>Email Template</title>


    <style type="text/css" media="screen">
        /* Linked Styles */
        body { padding:0 !important; margin:0 !important; display:block !important; -webkit-text-size-adjust:none; background-image:url(images/bg.jpg); background-position:0 0; background-repeat:no-repeat repeat-y }
        a { color:#51a17d; text-decoration:underline }
        h2 a, .h2 a { color:#7c7c7c; text-decoration:none }
        .footer a { color:#999999; text-decoration:underline }

        /* Campaign Monitor wraps the text in editor in paragraphs. In order to preserve design spacing we remove the padding/margin */
        p { padding:0 !important; margin:0 !important } 
    </style>
</head>
<body class="body" style="padding:0 !important; margin:0 !important; display:block !important; -webkit-text-size-adjust:none; background-image:url(images/bg.jpg); background-position:0 0; background-repeat:no-repeat repeat-y">

<table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-image: url(images/bg.jpg); background-position: 0 0; background-repeat: no-repeat repeat-y;">
    <tr>
        <td align="center" valign="top">
            <!-- Top -->
            <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#121211">
                <tr>
                    <td align="center">
                        <table width="620" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td class="img" style="font-size:0pt; line-height:0pt; text-align:left" width="1"><div style="font-size:0pt; line-height:0pt; height:34px"><img src="images/empty.gif" width="1" height="34" style="height:34px" alt="" /></div>
</td>   
                                <td class="top" style="color:#a4a4a4; font-family:'Trebuchet MS'; font-size:11px; line-height:15px; text-align:left">Having trouble reading this email? <a class="link-top" style="color:#528036; text-decoration:underline" target="_blank" href="*|ARCHIVE|*">View it in your browser</a></td>
                                <td align="right">
                                    <table border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td class="img" style="font-size:0pt; line-height:0pt; text-align:left" width="10"><img src="images/bullet1.jpg" alt="" border="0" width="6" height="5" /></td>
                                            <td class="top" style="color:#a4a4a4; font-family:'Trebuchet MS'; font-size:11px; line-height:15px; text-align:left"><a class="link-top" style="color:#528036; text-decoration:underline" target="_blank" href="*|UPDATE_PROFILE|*">Update preferences</a></td>
                                            <td class="img" style="font-size:0pt; line-height:0pt; text-align:left" width="15"></td>
                                            <td class="img" style="font-size:0pt; line-height:0pt; text-align:left" width="10"><img src="images/bullet1.jpg" alt="" border="0" width="6" height="5" /></td>
                                            <td class="top" style="color:#a4a4a4; font-family:'Trebuchet MS'; font-size:11px; line-height:15px; text-align:left"><a class="link-top" style="color:#528036; text-decoration:underline" target="_blank" href="*|FORWARD|*">Forward to a friend</a></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            <div style="font-size:0pt; line-height:0pt; height:1px; background:#000000; "><img src="images/empty.gif" width="1" height="1" style="height:1px" alt="" /></div>

            <div style="font-size:0pt; line-height:0pt; height:1px; background:#3d3e3e; "><img src="images/empty.gif" width="1" height="1" style="height:1px" alt="" /></div>

            <!-- END END -->
            <div style="font-size:0pt; line-height:0pt; height:30px"><img src="images/empty.gif" width="1" height="30" style="height:30px" alt="" /></div>


            <!-- Header -->
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td align="center">
                        <table width="620" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/logo.png" mc:edit="image_1" mc:allowdesigner mc:allowtext alt="" border="0" width="274" style="max-width:274px" height="35" /></td>
                                <td class="date" style="color:#8f908f; font-family:'Trebuchet MS'; font-size:17px; line-height:21px; text-align:right"><span>*|DATE:d|*</span> <span>*|DATE:F|*</span> <span>*|CURRENT_YEAR|*</span></td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            <!-- END Header -->
            <div style="font-size:0pt; line-height:0pt; height:20px"><img src="images/empty.gif" width="1" height="20" style="height:20px" alt="" /></div>


            <!-- Featured Content -->
            <div class="img-center" style="font-size:0pt; line-height:0pt; text-align:center"><img src="images/featured_img.jpg" mc:edit="image_2" mc:allowdesigner mc:allowtext alt="" border="0" width="620" style="max-width:620px" height="277" /></div>
            <!-- END Featured Content -->
            <div style="font-size:0pt; line-height:0pt; height:20px"><img src="images/empty.gif" width="1" height="20" style="height:20px" alt="" /></div>


            <!-- Content -->
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td align="center">
                        <table width="620" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td bgcolor="#ffffff">
                                    <div class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/mainbox_top.jpg" alt="" border="0" width="620" height="3" /></div>
                                    <div style="font-size:0pt; line-height:0pt; height:15px"><img src="images/empty.gif" width="1" height="15" style="height:15px" alt="" /></div>

                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td class="img" style="font-size:0pt; line-height:0pt; text-align:left" width="15"></td>
                                            <td valign="top" width="368" class="text" style="color:#5f5f60; font-family:'Trebuchet MS'; font-size:12px; line-height:16px; text-align:left; background:#ffffff !important">
                                                <div mc:repeatable>
                                                    <div class="h2" style="color:#201f1f; font-family:'Trebuchet MS'; font-size:17px; line-height:21px; text-align:left; font-weight:bold; background:#ffffff !important">
                                                        <div mc:edit="title_1">Beautiful Day in Paradise - In the Morning</div>
                                                    </div>
                                                    <div style="font-size:0pt; line-height:0pt; height:10px"><img src="images/empty.gif" width="1" height="10" style="height:10px" alt="" /></div>


                                                    <table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#6f7070">
                                                        <tr>
                                                            <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/img1.jpg" mc:edit="image_3" mc:allowdesigner mc:allowtext alt="" border="0" width="366" style="max-width:366px" height="209" /></td>
                                                        </tr>
                                                    </table>
                                                    <div style="font-size:0pt; line-height:0pt; height:10px"><img src="images/empty.gif" width="1" height="10" style="height:10px" alt="" /></div>


                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                        <tr>
                                                            <td align="left">
                                                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                                    <tr>
                                                                        <td width="82">
                                                                            <table border="0" cellspacing="0" cellpadding="1" bgcolor="#a8a8a8">
                                                                                <tr>
                                                                                    <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/thumb1.jpg" mc:edit="image_4" mc:allowdesigner mc:allowtext alt="" border="0" width="80" style="max-width:80px" height="50" /></td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                        <td width="13"></td>
                                                                        <td width="82">
                                                                            <table border="0" cellspacing="0" cellpadding="1" bgcolor="#a8a8a8">
                                                                                <tr>
                                                                                    <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/thumb2.jpg" mc:edit="image_5" mc:allowdesigner mc:allowtext alt="" border="0" width="80" style="max-width:80px" height="50" /></td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                        <td width="13"></td>
                                                                        <td width="82">
                                                                            <table border="0" cellspacing="0" cellpadding="1" bgcolor="#a8a8a8">
                                                                                <tr>
                                                                                    <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/thumb3.jpg" mc:edit="image_6" mc:allowdesigner mc:allowtext alt="" border="0" width="80" style="max-width:80px" height="50" /></td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                        <td width="13"></td>
                                                                        <td width="82">
                                                                            <table border="0" cellspacing="0" cellpadding="1" bgcolor="#a8a8a8">
                                                                                <tr>
                                                                                    <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/thumb4.jpg" mc:edit="image_7" mc:allowdesigner mc:allowtext alt="" border="0" width="80" style="max-width:80px" height="50" /></td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <div style="font-size:0pt; line-height:0pt; height:10px"><img src="images/empty.gif" width="1" height="10" style="height:10px" alt="" /></div>


                                                    <div mc:edit="text_1">
                                                        In ultricies bibendum risus sit amet placerat. Vivamus porttitor ornare mattis. Curabitur laoreet nisl felis, non blandit turpis. Quisque vitae metus mi. Integer volutpat, metus quis.
                                                    </div>
                                                    <div style="font-size:0pt; line-height:0pt; height:10px"><img src="images/empty.gif" width="1" height="10" style="height:10px" alt="" /></div>


                                                    <div class="img" style="font-size:0pt; line-height:0pt; text-align:left">
                                                        <img src="images/read_more.jpg" mc:edit="image_8" mc:allowdesigner mc:allowtext alt="" border="0" width="113" style="max-width:113px" height="32" />
                                                    </div>
                                                    <div style="font-size:0pt; line-height:0pt; height:30px"><img src="images/empty.gif" width="1" height="30" style="height:30px" alt="" /></div>

                                                    <div style="font-size:0pt; line-height:0pt; height:1px; background:#bfbfbf; "><img src="images/empty.gif" width="1" height="1" style="height:1px" alt="" /></div>

                                                    <div style="font-size:0pt; line-height:0pt; height:25px"><img src="images/empty.gif" width="1" height="25" style="height:25px" alt="" /></div>

                                                </div>  


                                                <div mc:repeatable>
                                                    <div class="h2" style="color:#201f1f; font-family:'Trebuchet MS'; font-size:17px; line-height:21px; text-align:left; font-weight:bold; background:#ffffff !important">
                                                        <div mc:edit="title_2">Beautiful Day in Paradise - In the Afternoon</div>
                                                    </div>
                                                    <div style="font-size:0pt; line-height:0pt; height:10px"><img src="images/empty.gif" width="1" height="10" style="height:10px" alt="" /></div>


                                                    <table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#6f7070">
                                                        <tr>
                                                            <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/img2.jpg" mc:edit="image_9" mc:allowdesigner mc:allowtext alt="" border="0" width="366" style="max-width:366px" height="209" /></td>
                                                        </tr>
                                                    </table>
                                                    <div style="font-size:0pt; line-height:0pt; height:10px"><img src="images/empty.gif" width="1" height="10" style="height:10px" alt="" /></div>


                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                        <tr>
                                                            <td align="left">
                                                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                                    <tr>
                                                                        <td width="82">
                                                                            <table border="0" cellspacing="0" cellpadding="1" bgcolor="#a8a8a8">
                                                                                <tr>
                                                                                    <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/thumb5.jpg" mc:edit="image_10" mc:allowdesigner mc:allowtext alt="" border="0" width="80" style="max-width:80px" height="50" /></td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                        <td width="13"></td>
                                                                        <td width="82">
                                                                            <table border="0" cellspacing="0" cellpadding="1" bgcolor="#a8a8a8">
                                                                                <tr>
                                                                                    <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/thumb6.jpg" mc:edit="image_11" mc:allowdesigner mc:allowtext alt="" border="0" width="80" style="max-width:80px" height="50" /></td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                        <td width="13"></td>
                                                                        <td width="82">
                                                                            <table border="0" cellspacing="0" cellpadding="1" bgcolor="#a8a8a8">
                                                                                <tr>
                                                                                    <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/thumb7.jpg" mc:edit="image_12" mc:allowdesigner mc:allowtext alt="" border="0" width="80" style="max-width:80px" height="50" /></td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                        <td width="13"></td>
                                                                        <td width="82">
                                                                            <table border="0" cellspacing="0" cellpadding="1" bgcolor="#a8a8a8">
                                                                                <tr>
                                                                                    <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/thumb8.jpg" mc:edit="image_13" mc:allowdesigner mc:allowtext alt="" border="0" width="80" style="max-width:80px" height="50" /></td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <div style="font-size:0pt; line-height:0pt; height:10px"><img src="images/empty.gif" width="1" height="10" style="height:10px" alt="" /></div>


                                                    <div mc:edit="text_2">
                                                        Etiam sit amet orci lorem, nec iaculis arcu. Aenean hendrerit augue id magna convallis sodales. Donec neque mauris, placerat quis ultrices vitae, rhoncus in enim nullam semper commodo.
                                                    </div>
                                                    <div style="font-size:0pt; line-height:0pt; height:10px"><img src="images/empty.gif" width="1" height="10" style="height:10px" alt="" /></div>


                                                    <div class="img" style="font-size:0pt; line-height:0pt; text-align:left">
                                                        <img src="images/read_more.jpg" mc:edit="image_14" mc:allowdesigner mc:allowtext alt="" border="0" width="113" style="max-width:113px" height="32" />
                                                    </div>
                                                    <div style="font-size:0pt; line-height:0pt; height:30px"><img src="images/empty.gif" width="1" height="30" style="height:30px" alt="" /></div>

                                                    <div style="font-size:0pt; line-height:0pt; height:1px; background:#bfbfbf; "><img src="images/empty.gif" width="1" height="1" style="height:1px" alt="" /></div>

                                                    <div style="font-size:0pt; line-height:0pt; height:25px"><img src="images/empty.gif" width="1" height="25" style="height:25px" alt="" /></div>

                                                </div>


                                                <div mc:repeatable>
                                                    <div class="h2" style="color:#201f1f; font-family:'Trebuchet MS'; font-size:17px; line-height:21px; text-align:left; font-weight:bold; background:#ffffff !important">
                                                        <div mc:edit="title_3">Beautiful Day in Paradise - At Night</div>
                                                    </div>
                                                    <div style="font-size:0pt; line-height:0pt; height:10px"><img src="images/empty.gif" width="1" height="10" style="height:10px" alt="" /></div>


                                                    <table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#6f7070">
                                                        <tr>
                                                            <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/img3.jpg" mc:edit="image_15" mc:allowdesigner mc:allowtext alt="" border="0" width="366" style="max-width:366px" height="209" /></td>
                                                        </tr>
                                                    </table>
                                                    <div style="font-size:0pt; line-height:0pt; height:10px"><img src="images/empty.gif" width="1" height="10" style="height:10px" alt="" /></div>


                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                        <tr>
                                                            <td align="left">
                                                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                                    <tr>
                                                                        <td width="82">
                                                                            <table border="0" cellspacing="0" cellpadding="1" bgcolor="#a8a8a8">
                                                                                <tr>
                                                                                    <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/thumb9.jpg" mc:edit="image_16" mc:allowdesigner mc:allowtext alt="" border="0" width="80" style="max-width:80px" height="50" /></td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                        <td width="13"></td>
                                                                        <td width="82">
                                                                            <table border="0" cellspacing="0" cellpadding="1" bgcolor="#a8a8a8">
                                                                                <tr>
                                                                                    <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/thumb10.jpg" mc:edit="image_17" mc:allowdesigner mc:allowtext alt="" border="0" width="80" style="max-width:80px" height="50" /></td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                        <td width="13"></td>
                                                                        <td width="82">
                                                                            <table border="0" cellspacing="0" cellpadding="1" bgcolor="#a8a8a8">
                                                                                <tr>
                                                                                    <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/thumb11.jpg" mc:edit="image_18" mc:allowdesigner mc:allowtext alt="" border="0" width="80" style="max-width:80px" height="50" /></td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                        <td width="13"></td>
                                                                        <td width="82">
                                                                            <table border="0" cellspacing="0" cellpadding="1" bgcolor="#a8a8a8">
                                                                                <tr>
                                                                                    <td class="img" style="font-size:0pt; line-height:0pt; text-align:left"><img src="images/thumb12.jpg" mc:edit="image_19" mc:allowdesigner mc:allowtext alt="" border="0" width="80" style="max-width:80px" height="50" /></td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <div style="font-size:0pt; line-height:0pt; height:10px"><img src="images/empty.gif" width="1" height="10" style="height:10px" alt="" /></div>


                                                    <div mc:edit="text_3">
                                                        In ultricies bibendum risus sit amet placerat. Vivamus porttitor ornare mattis. Curabitur laoreet nisl felis, non blandit turpis. Quisque vitae metus mi. Integer volutpat, metus quis.
                                                    </div>
                                                    <div style="font-size:0pt; line-height:0pt; height:10px"><img src="images/empty.gif" width="1" height="10" style="height:10px" alt="" /></div>


                                                    <div class="img" style="font-size:0pt; line-height:0pt; text-align:left">
                                                        <img src="images/read_more.jpg" mc:edit="image_20" mc:allowdesigner mc:allowtext alt="" border="0" width="113" style="max-width:113px" height="32" />
                                                    </div>
                                                </div>
                                            </td>
                                            <td class="img" style="font-size:0pt; line-height:0pt; text-align:left" width="22"></td>
                                            <td class="img" style="font-size:0pt; line-height:0pt; text-align:left" width="1" bgcolor="#bfbfbf"></td>
                                            <td class="img" style="font-size:0pt; line-height:0pt; text-align:left" width="21"></td>
                                            <td valign="top" class="text" style="color:#5f5f60; font-family:'Trebuchet MS'; font-size:12px; line-height:16px; text-align:left; background:#ffffff !important" width="170">

                                                <div mc:repeatable>
                                                    <div class="h2" style="color:#201f1f; font-family:'Trebuchet MS'; font-size:17px; line-height:21px; text-align:left; font-weight:bold; background:#ffffff !important">
                                                        <div mc:edit="title_4">Sidebar List</div>
                                                    </div>
                                                    <div style="font-size:0pt; line-height:0pt; height:5px"><img src="images/empty.gif" width="1" height="5" style="height:5px" alt="" /></div>

                                                    <div mc:edit="text_4">Quisque vitae ligula arcu, in dona  eu rutrum magna.</div>
                                                    <div style="font-size:0pt; line-height:0pt; height:10px"><img src="images/empty.gif" width="1" height="10" style="height:10px" alt="" /></div>

                                                    <div style="font-size:0pt; line-height:0pt; height:1px; background:#bfbfbf; "><img src="images/empty.gif" width="1" height="1" style="height:1px" alt="" /></div>

                                                    <div style="font-size:0pt; line-height:0pt; height:5px"><img src="images/empty.gif" width="1" height="5" style="height:5px" alt="" /></div>

                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                        <tr>
                                                            <td class="img" style="font-size:0pt; line-height:0pt; text-align:left" width="8"><img src="images/bullet2.jpg" alt="" border="0" width="3" height="6" /></td>
                                                            <td class="text" style="color:#5f5f60; font-family:'Trebuchet MS'; font-size:12px; line-height:16px; text-align:left; background:#ffffff !important">
                                                                <div mc:edit="text_5"><a href="#" target="_blank" class="link" style="color:#51a17d; text-decoration:none"><span class="link" style="color:#51a17d; text-decoration:none">Lorem lipsum dolor</span></a></div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <div style="font-size:0pt; line-height:0pt; height:7px"><img src="images/empty.gif" width="1" height="7" style="height:7px" alt="" /></div>

                                                    <div style="font-size:0pt; line-height:0pt; height:1px; background:#bfbfbf; "><img src="images/empty.gif" width="1" height="1" style="height:1px" alt="" /></div>

                                                    <div style="font-size:0pt; line-height:0pt; height:5px"><img src="images/empty.gif" width="1" height="5" style="height:5px" alt="" /></div>


                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                        <tr>
                                                            <td class="img" style="font-size:0pt; line-height:0pt; text-align:left" width="8"><img src="images/bullet2.jpg" alt="" border="0" width="3" height="6" /></td>
                                                            <td class="text" style="color:#5f5f60; font-family:'Trebuchet MS'; font-size:12px; line-height:16px; text-align:left; background:#ffffff !important">
                                                                <div mc:edit="text_6"><a href="#" target="_blank" class="link" style="color:#51a17d; text-decoration:none"><span class="link" style="color:#51a17d; text-decoration:none">Etiam in diam lacus in amet</span></a></div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <div style="font-size:0pt; line-height:0pt; height:7px"><img src="images/empty.gif" width="1" height="7" style="height:7px" alt="" /></div>

                                                    <div style="font-size:0pt; line-height:0pt; height:1px; background:#bfbfbf; "><img src="images/empty.gif" width="1" height="1" style="height:1px" alt="" /></div>

                                                    <div style="font-size:0pt; line-height:0pt; height:5px"><img src="images/empty.gif" width="1" height="5" style="height:5px" alt="" /></div>




                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                        <tr>
                                                            <td class="img" style="font-size:0pt; line-height:0pt; text-align:left" width="8"><img src="images/bullet2.jpg" alt="" border="0" width="3" height="6" /></td>
                                                            <td class="text" style="color:#5f5f60; font-family:'Trebuchet MS'; font-size:12px; line-height:16px; text-align:left; background:#ffffff !important">
                                                                <div mc:edit="text_7"><a href="#" target="_blank" class="link" style="color:#51a17d; text-decoration:none"><span class="link" style="color:#51a17d; text-decoration:none">Praesent lobortis enim nec</span></a></div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <div style="font-size:0pt; line-height:0pt; height:7px"><img src="images/empty.gif" width="1" height="7" style="height:7px" alt="" /></div>

                                                    <div style="font-size:0pt; line-height:0pt; height:1px; background:#bfbfbf; "><img src="images/empty.gif" width="1" height="1" style="height:1px" alt="" /></div>

                                                    <div style="font-size:0pt; line-height:0pt; height:5px"><img src="images/empty.gif" width="1" height="5" style="height:5px" alt="" /></div>



                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                        <tr>
                                                            <td class="img" style="font-size:0pt; line-height:0pt; text-align:left" width="8"><img src="images/bullet2.jpg" alt="" border="0" width="3" height="6" /></td>
                                                            <td class="text" style="color:#5f5f60; font-family:'Trebuchet MS'; font-size:12px; line-height:16px; text-align:left; background:#ffffff !important">
                                                                <div mc:edit="text_8"><a href="#" target="_blank" class="link" style="color:#51a17d; text-decoration:none"><span class="link" style="color:#51a17d; text-decoration:none">Quisque eget sapien dolor</span></a></div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <div style="font-size:0pt; line-height:0pt; height:7px"><img src="images/empty.gif" width="1" height="7" style="height:7px" alt="" /></div>

                                                    <div style="font-size:0pt; line-height:0pt; height:1px; background:#bfbfbf; "><img src="images/empty.gif" width="1" height="1" style="height:1px" alt="" /></div>

                                                    <div style="font-size:0pt; line-height:0pt; height:25px"><img src="images/empty.gif" width="1" height="25" style="height:25px" alt="" /></div>

                                                </div>

                                                <div mc:repeatable>

                                                </div>

                                                <div mc:repeatable>
                                                    <div class="h2" style="color:#201f1f; font-family:'Trebuchet MS'; font-size:17px; line-height:21px; text-align:left; font-weight:bold; background:#ffffff !important">
                                                        <div mc:edit="title_6">Advertisement</div>
                                                    </div>

</table>

</body>
</html>

上面的脚本有

<?php
        $my_newsletter=$this->autoload_model->get_data_from_table('td_newsletter','*',"newsletter_id = '$newsletter_id'")->result_array();
        $bodytag = str_replace("%images/%", base_url().'application/admin/views/newsletter/'.$my_newsletter[0]['newsletter_title'].'/images/', "%images/%");
?>

但是当我在浏览器中查看页面并按 ctrl +U 时,我只看到 img srcimages/1.jpg并没有http://localhost/chroncile/application/admin/views/newsletter/123kfur56_newsletter-1/images/1.jpg

我怎样才能自动设置它???在页面加载??

4

2 回答 2

0
$content =<<<HTML
<head>
...
</head>
<body>
...
</body>
HTML;
$content = preg_replace('/<img src="image([0-9]+)" \/>/', '<img src="<?php echo base_url();?>application/admin/views/newsletter/126hfuueye_newsletter-1/images/$1.jpg" />', $content);
print($content);

我不确定 REGEX 是否能正常工作。试试看。

于 2013-08-25T18:13:38.050 回答
0

尝试以下 javascript 方法。如果您只需要在页面加载时替换图像标签。您可以为类指定img要替换其src内容的标签,以便于访问。

  <html>
<title></title>
<head>
<?php
$my_newsletter=$this->autoload_model->get_data_from_table('td_newsletter','*',"newsletter_id = '$newsletter_id'")->result_array();
$bodytag=base_url().'application/admin/views/newsletter/'.$my_newsletter[0]['newsletter_title'].'/images/'.$your image_file;
?>
     <script>
     //<img src="images/1.jpg" class="my_image" /> we give class to image tag we want to replace  src tag
     var image_path="<?php echo $bodytag; ?>";
     $("img.my_image").attr("src",image_path);
     </script>
</head>
<bod>
....
</body>
</html>
于 2013-08-25T19:13:05.890 回答