What's new

Text problem

loktoy

Eternal Poster
Joined
Oct 20, 2014
Posts
1,168
Solutions
2
Reaction
103
Points
497
Age
30
bakit kaya ganito lumalabas sa output ko..

All features from the old conversation system Reactions, quotes, mentions, notifications, reports, bans, attachments, etc. Separate messenger layout Prebuilt themes (Inherited from Real-Time Chat themes) Search by: conversations, attachments Mark-rea

pero nun nag insert ako sa database ganito format
All features from the old conversation system
  • Reactions, quotes, mentions, notifications, reports, bans, attachments, etc.
  • Separate messenger layout
  • Prebuilt themes (Inherited from Real-Time Chat themes)
  • Search by: conversations, attachments
  • Mark-read message system
  • Message deletion

pano ko kaya sya magaganyan ang output ko kapag sakali mag input ako ng ganyan design at mainsert ko sa database ko sana kapag mag output din is ganyan din
 
Ang iyong output ay lumalabas nang hindi inaasahan dahil ang format ng iyong input ay hindi na-maintain sa pag-insert sa database. Upang ma-maintain ang format ng iyong input kapag ini-insert mo ito sa iyong database at kapag ibinabalik ito bilang output, maaari mong gamitin ang HTML tags.

Sa halimbawang naibigay mo, maaaring gamitin mo ang <ul> at <li> tags upang ma-maintain ang listahan ng iyong mga feature. Narito ang isang halimbawang code kung paano mo maaaring gawin ito:

PHP:
$input = 'All features from the old conversation system
[LIST]
[*]Reactions, quotes, mentions, notifications, reports, bans, attachments, etc.
[*]Separate messenger layout
[*]Prebuilt themes (Inherited from Real-Time Chat themes)
[*]Search by: conversations, attachments
[*]Mark-read message system
[*]Message deletion
[/LIST]';

// Convert [LIST] tags to HTML list
$input = preg_replace('/\[LIST\](.*?)\[\/LIST\]/s', '<ul>$1</ul>', $input);

// Convert [*] tags to HTML list items
$input = preg_replace('/\[\*\](.*?)\n/s', '<li>$1</li>', $input);

echo $input;

Ang output ng code na ito ay magiging:

HTML:
All features from the old conversation system
<ul>
<li>Reactions, quotes, mentions, notifications, reports, bans, attachments, etc.</li>
<li>Separate messenger layout</li>
<li>Prebuilt themes (Inherited from Real-Time Chat themes)</li>
<li>Search by: conversations, attachments</li>
<li>Mark-read message system</li>
<li>Message deletion</li>
</ul>

Sa pamamagitan ng paggamit ng mga HTML tags tulad ng <ul> at <li>, maaari mong i-maintain ang formato ng iyong input kapag ini-insert mo ito sa database at kapag ibinalik ito bilang output. Pwede mong i-customize ang style ng iyong listahan gamit ang CSS upang masakop ang iyong disenyo.
 
Ang iyong output ay lumalabas nang hindi inaasahan dahil ang format ng iyong input ay hindi na-maintain sa pag-insert sa database. Upang ma-maintain ang format ng iyong input kapag ini-insert mo ito sa iyong database at kapag ibinabalik ito bilang output, maaari mong gamitin ang HTML tags.

Sa halimbawang naibigay mo, maaaring gamitin mo ang <ul> at <li> tags upang ma-maintain ang listahan ng iyong mga feature. Narito ang isang halimbawang code kung paano mo maaaring gawin ito:

PHP:
$input = 'All features from the old conversation system
[LIST]
[*]Reactions, quotes, mentions, notifications, reports, bans, attachments, etc.
[*]Separate messenger layout
[*]Prebuilt themes (Inherited from Real-Time Chat themes)
[*]Search by: conversations, attachments
[*]Mark-read message system
[*]Message deletion
[/LIST]';

// Convert [LIST] tags to HTML list
$input = preg_replace('/\[LIST\](.*?)\[\/LIST\]/s', '<ul>$1</ul>', $input);

// Convert [*] tags to HTML list items
$input = preg_replace('/\[\*\](.*?)\n/s', '<li>$1</li>', $input);

echo $input;

Ang output ng code na ito ay magiging:

HTML:
All features from the old conversation system
<ul>
<li>Reactions, quotes, mentions, notifications, reports, bans, attachments, etc.</li>
<li>Separate messenger layout</li>
<li>Prebuilt themes (Inherited from Real-Time Chat themes)</li>
<li>Search by: conversations, attachments</li>
<li>Mark-read message system</li>
<li>Message deletion</li>
</ul>

Sa pamamagitan ng paggamit ng mga HTML tags tulad ng <ul> at <li>, maaari mong i-maintain ang formato ng iyong input kapag ini-insert mo ito sa database at kapag ibinalik ito bilang output. Pwede mong i-customize ang style ng iyong listahan gamit ang CSS upang masakop ang iyong disenyo.
bat ayaw sa code ko di gumana

$sql = mysqli_query ($con, "SELECT * FROM reminder");
while ($row = mysqli_fetch_assoc($sql)){
$reminder = $row['reminder'];

}
$input = $reminder;


// Convert
  • tags to HTML list
    $input = preg_replace('/\[LIST\](.*?)\[\/LIST\]/s', '<ul>$1</ul>', $input);

    // Convert
  • tags to HTML list items
    $input = preg_replace('/\[\\](.?)\n/s', '<li>$1</li>', $input);

    ?>
    <p><?php echo $input; ?></p>
 
bat ayaw sa code ko di gumana

$sql = mysqli_query ($con, "SELECT * FROM reminder");
while ($row = mysqli_fetch_assoc($sql)){
$reminder = $row['reminder'];

}
$input = $reminder;


// Convert
  • tags to HTML list
    $input = preg_replace('/\[LIST\](.*?)\[\/LIST\]/s', '<ul>$1</ul>', $input);

    // Convert
  • tags to HTML list items
    $input = preg_replace('/\[\\](.?)\n/s', '<li>$1</li>', $input);

    ?>
    <p><?php echo $input; ?></p>
Paumanhin, mayroong mali sa iyong code. Nagkakaroon ka ng error dahil sa maling paggamit ng mga regex pattern sa iyong mga pagpapalit.

Narito ang tamang bersyon ng iyong code:

PHP:
$sql = mysqli_query($con, "SELECT * FROM reminder");
while ($row = mysqli_fetch_assoc($sql)) {
    $reminder = $row['reminder'];
}

$input = $reminder;

// Convert [LIST] tags to HTML list
$input = preg_replace('/\[LIST\](.*?)\[\/LIST\]/s', '<ul>$1</ul>', $input);

// Convert [*] tags to HTML list items
$input = preg_replace('/\[\*\](.*?)\n/s', '<li>$1</li>', $input);

echo $input;

Maaaring hindi gumagana ng tama ang pagpapalit ng mga tags sa iyong text. Siguraduhin na ang mga tags sa iyong input ay tumpak. Maaari mong baguhin ang mga regex pattern kung kinakailangan depende sa eksaktong format ng iyong mga tags.
 
Back
Top