Question Body Goes Out Of The Box When Showing It At Blade - php

I'm working on a Forum project using Laravel 9 and for posting a new question, if I enter the text like this (without pressing Enter or adding </br>):
Then the body of the question will be shown like this:
And as you can see it overlaps the box that is in it and goes out which is wrong!
And this is the code for showing the body:
<div class="topic__text BYekan">
<p>
{{ $question->que_body }}
</p>
</div>
So what's going wrong here?
How can I solve this issue?

You need styling, specifically
topic__text p {
overflow-wrap: break-word;
}

If you are using one of laravel starter kit, you must be using tailwind.
Here you can find class that most suitable to your need.
Overflow = https://tailwindcss.com/docs/overflow
Overscroll = https://tailwindcss.com/docs/overscroll-behavior

Related

Laravel checkbox not checking just because changing layout

Working on Laravel Project, I have two layouts.
app.blade.php see on my git repo
old_app.blade.php see on my git repo
When I use #extends('layouts.old_app') in my blade file, its working fine like this:
old_app.blade.php
But when I use #extends('layouts.app') in my blade file, the checkbox is gone:
app.blade.php
This is my Controller:
public function create()
{
$permission = Permission::get();
return view('roles.create', compact('permission'));
}
This is my View
<div class="form-group">
#foreach($permission as $value)
<label>{{$value->name}}
<input type="checkbox" class="name" value="{{$value->id}}" name="permission[]">
</label>
#endforeach
</div>
Sorry for my bad english, I would to say thanks for anyone who can help me.
I could think in 2 obvious things.
Permission::get(); does not return any record (maybe you forgot to seed the database, to little info to speculate)
You got a problem with the html + css, either the template have a error or you are forgetting something like a div.row before the checkbox, try pasting a working set of checkbox inside the view, if you can't see it, try putting it before the #yield('content')

Getting the content of a div in google translate not working

I'm trying to get the content of the div with id result_box in google translate using simple_html_dom, but it returns nothing. I tried to return another div's content and it worked perfectly. looks like the problem is just with that div.
result_box is the div that the translation will appear on.
here is my code
$googleSearch="the contente i want to translate";
$googlePage="https://translate.google.com/#en/ar/$googleSearch";
$Chtml = file_get_html($googlePage);
$gt = $Chtml->find('#result_box ',0)->plaintext;
echo '<br>'.$gt.'<br>';
What could be the cause? and how can I solve it?
If this can't be done with simple html dom, is there any alternative ways to do it?
Note that I don't want to use Google translate API
The result_box element does not have any plain text:
<div style="zoom:1" dir="ltr">
<div id="tts_button">
<span id="result_box" class="short_text" lang="en">
<span class="hps">spring</span>
</span>
</div>
I don't know what $Chtml->find('#result_box',0) is doing, but probably you need to iterate to the next <span> and get the text from there
EDIT:
Furthermore, I do not know whether the trailing blank on the Id would probably prevent simple_hmtl_dom from finding anything:
$Chtml->find('#result_box ',0) vs. $Chtml->find('#result_box',0)

Add <div> on a MediaWiki geshi syntax highlight extension

I use mediawiki to take note about the procedure that I follow, the source codes I write in mediawiki are highlighted with the expansion Genshi Syntax HighLight. I want to modify this expansion in mediawiki so it could be created a box above the source code in which it is written the programming language I used. I tried to see expansion sources in my mediawiki but I didn't find the segment in which is "sketch" the <div>. I also saw material about the creation of new expansion in mediawiki to understand how it runs, but I don't understand where the box is created.
I use syntax hightligher like this
some_code
and this is the result in html code generate from mediawiki
<div class="mw-geshi mw-code mw-content-ltr" dir="ltr">
<div class="bash source-bash">
<pre class="de1">
some_code
</pre>
</div>
</div>
I want to prepen the div to first div, like this
<div class='gsh-lang-label'>Language bash</div>
<div class="mw-geshi mw-code mw-content-ltr" dir="ltr">
<div class="bash source-bash">
<pre class="de1">
some_code
</pre>
</div>
</div>
Can you explain me if it is possible to do it and how can I face the problem?
I think ordinary jQuery will solve this problem. Something like:
$(".mw-geshi").each(function(){
$(this).before("<div class='gsh-lang-label'>" +
$(this).children().first().attr("class").split(' ')[0] +
"</div>")
})
Put this in [[MediaWiki:Common.js]], so this script will be run for every user.

Remove heading from Superfish Menu Drupal 7

I'm working with Drupal for the first time, and have been able to find answers for all of my other questions, so far, on either Drupal's forms or via other means. However, I can't seem to find a way to remove the "Main Menu" header from my superfish menu.
I've created a region called superfish and added superfish to it successfully. But above the menu there is an Main Menu that I would like to remove. There doesn't seem to be a way to do this from the superfish options, and i can't seem to find where in the code this is being appended, or else I would just comment out that line. I've searched in the superfish.js file as well as the 'superfish.module` file and can't seem to find it. I'm a programmer first and a 'web designer' second, so getting my hands dirty in some code is not a problem, in fact, I would prefer to do it that way.
Has anyone else done this? Or know where I should start to look?
This is the html that is generated at runtime:
<div id="superfish">
<div class="region region-superfish">
<div id="block-superfish-1" class="block block-superfish contextual-links-region">
<h2>Main menu</h2>
<div class="contextual-links-wrapper contextual-links-processed">
<div class="content">
<ul id="superfish-1" class="menu sf-menu sf-main-menu sf-horizontal sf-style-simple sf-total-items-2 sf-parent-items-1 sf-single-items-1 superfish-processed sf-js-enabled sf-shadow">
<li id="menu-221-1" class="active-trail first odd sf-item-1 sf-depth-1 sf-no-children">
<li id="menu-312-1" class="active-trail last even sf-item-2 sf-depth-1 sf-total-children-1 sf-parent-children-0 sf-single-children-1 menuparent">
</ul>
</div>
</div>
</div>
Thanks!
I stumbled across the real answer... Isn't it funny that one tends to figure things out when they stop thinking about them?
The main menu header was the block title, when editing the superfish block the very first field is Block Title this allows one to override the default setting of the block title. By placing <none> in this field, the block title is no longer displayed.
Apart from finding where that HTML is output, which is the ideal solution, you could use jquery after the fact to remove the title.
$('#superfish h2').html('');
jsfiddle here: http://jsfiddle.net/DetEb/

anchor tag seems to not be closed

What is wrong with my code here, when I click on the ending tag in this bit of html it doesnt light up as having a partner. I think its probably related to the PHP in the code but I am not sure. The link does work in safari and chrome but has trouble in other browsers. Please let me know what you think
<td class="stat">
<a data-ajax="false" href="following.php?id=<?php echo $row['id_user']?>">
<div class="statnum"><?php echo $row2['COUNT(username)']?></div>
<div class="statlabel">FOLLOWING</div>
</a>
In HTML 4.x, an <a> element cannot contain a <div> element.
This changed in HTML 5, but:
Some browsers have issues with it, especially if you do not explicitly set display: block on the <a>
Your editor's syntax highlighter may not have caught up with that change

Categories