- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
该类通过在找到 [next] 的任何地方展开内容来工作。但问题是 next 被包裹在 div 中,所以它变成了 <div>[next]</div>
,这是因为我使用的是所见即所得的编辑器。当它在第一页上找到 [next] 时,</div>
在它转移到第二页等之后,阻碍了布局。
所以要展开文本的类:
function splitText($pageCont){
$this->textarray = explode('[next]', $pageCont);
$this->numPages = count($this->textarray);
}
和回显文本 block 的类
function getContent(){
if($this->page != 0){
echo $this->pageCont;
} else {
echo $this->textarray[0];
}
}
问题是,我怎样才能阻止这种情况发生,或者使主 div 中的 div 不影响页面布局?就好像现在当 div 吐出时它会将右列推到右下角
由 kuh-chan 编辑的完整代码
class Pagebreak {
private $page; //page number
private $numPages; //number of total pages
private $textarray = array(); // array of conents
private $pageCont; //current page content
public function __construct(){
if (!isset($_GET['page'])) {
$this->page = 0;
} else {
$this->page = $_GET['page'];
}
}
public function splitText($pageCont){
$this->textarray = preg_split('/(?<!\<div\>)\[next\]/', $pageCont);
$this->numPages = count($this->textarray);
}
public function setPage(){
$this->pageCont = $this->textarray[$_GET['page'] -1];
}
public function getContent(){
if($this->page != 0){
echo $this->pageCont;
} else {
echo $this->textarray[0];
}
}
public function getPageLinks(){
echo "<p class=\"article_page_div\">\n";
//prev page
//if page number is more then 1 show previous link
if ($this->page > 1) {
$prevpage = $this->page - 1;
echo "<a class=\"article_paging\" href=\"?post=".$_GET['post']."&page=$prevpage\">". 'Prev</a> ';
}
//page numbers
for($i = 1; $i <= $this->numPages ; $i++){
if($this->numPages > 1){ // if more then 1 page show links
if(($this->page) == $i){ //if page number is equal page number in loop don't link it
echo "$i\n ";
} else {
if($this->page == 0){ //if no page numbers have been clicked don't link first page link
if($i == 1){
echo "$i\n ";
} else { // link the rest
echo "<a class=\"article_paging\" href=\"?post=".$_GET['post']."&page=$i\">$i</a>\n ";
}
} else { // link pages
echo "<a class=\"article_paging\" href=\"?post=".$_GET['post']."&page=$i\">$i</a>\n ";
}
}
}
}
//next page
//if page number is less then the total number of pages show next link
if ($this->page <= $this->numPages - 1) {
if($this->page == 0){ //if no page numbers have been clicked minus 2 from the next page link
$nextpage = $this->page + 2;
} else {
$nextpage = $this->page + 1;
}
echo "<a class=\"article_paging\" href=\"?post=".$_GET['post']."&page=$nextpage\">". 'Next</a>';
}
echo "</p>\n";
}
}
然后调用你刚刚使用的这个类:
$paginate = new Pagebreak();
$paginate->splitText($storyCont);
$paginate->setPage();
$paginate->getContent();
$paginate->getPageLinks();
最佳答案
the question is, how can I either stop this from happening, or make it so that the divs within the main div does not affect the page layout? as if now when the divs spit it pushes the right column to the right bottom
使用以下 CSS 属性之一从页面流中删除 div:
使用以下 CSS 属性将主 div 用作定位 div 的容器:
关于css - 文章分页类拆分 div 并弄乱页面布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10596424/
我正在尝试创建一个 Django 网站,每次在本地主机上运行/articles/api/article 页面时:我都会收到此回溯: Environment: Request Method: GET R
我正在尽最大努力理解开放图谱协议(protocol)中的一切含义阅读 FB page在上面和 OGP Page .这在 FB 和 OGP 的世界中究竟意味着什么: Note that the Open
我的 HTML/CSS 中存在页脚与文章内容重叠的问题。是的,我一直在网上搜索但似乎没有任何效果,我希望你知道它有什么问题。我在这里做了一个codepen: CodePen LINK
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
我可以将变量作为警报显示在函数中,但无法将变量传递给文章。我做错了什么? 我知道“a”保存了正确的信息,因为我已经通过警报显示了它。 我尝试使用以下方式传递变量:placeholderContent.
这个问题已经有答案了: Rails article helper - "a" or "an" (6 个回答) 已关闭 3 年前。 是否有类似 [#pluralize in ActiveSupport]
这个问题已经有答案了: Rails article helper - "a" or "an" (6 个回答) 已关闭 3 年前。 是否有类似 [#pluralize in ActiveSupport]
我有以下型号。 Book has Articles (Article has foreign key to Book) Article has Images (Article has upto #ma
我创建了一个页面,该页面显示了单个 类别下的所有帖子,即如果我单击类别音乐,我将获得与音乐类别相关的所有文章。 但我的目标是创建一个过滤选项,它可以过滤掉某些类别,并且只显示与您过滤的类别相关的所有帖
我使用这样的代码: $query = "SELECT introtext FROM #__content WHERE alias = '$alias'"; $db->setQuery($query);
我在主页上设置了一些特色文章。显示的所有文章似乎都剩下太多填充。我知道足以进入 css 并在 layout.css 上编辑 .itembody 的填充或边距,但似乎没有任何改变。我希望我的文章通过模块
ORM 中存储文章及其修订的最佳实践是什么?当我自己用SQL存储时,我曾经有以下结构: articles [id, parent_id, name, text] 通过parent_id,我可以轻松识
我的 HTML : Interest About Interest
我正在用jade构建一个nodejs、express、mongodb博客。 我的文件夹结构是:项目/ 模块/ 观点/ 索引.jade 应用程序.js 文章提供者内存.js 文章provider-mon
我的问题比较具体,至少对我来说是这样。具体是因为在做了很多搜索之后我找不到任何有用的东西。因此,正如标题所说,我正在寻找一种算法,它会发现输入中给出的两篇文章是否“匹配”,但不是通常的字符串匹配意义上
关闭。这个问题是off-topic .它目前不接受答案。 9年前关闭。 锁定。这个问题及其答案是locked因为这个问题是题外话,但具有历史意义。它目前不接受新的答案或互动。 我无法弄清楚动态编程的原
我有这个问题。我正在建立一个社交网站,我必须在两栏中创建帖子。父容器是一个部分,元素“post”是样式为 float: left 的文章。我如何让滑到那些较短的下方创建的空白空间的帖子? 最佳答案 c
这里有几个关于文件与数据库的问题,但我仍然不确定使用什么以及为什么在我的案例中应该使用它。 我的网站上有很多 HTML 文章(长度在几百到几千字之间)。在数据库 (MySQL) 中,我有一个没有搜索索
微信公众号文章 Semantic Kernel —— LangChain 的替代品? [1] ,它使用的示例代码是Python ,他却发了这么一个疑问: 支持的语言对比(因为 Sem
我想编写一个 polymer 元素来显示一些 WordPress 文章。 http://www.jsv-lippstadt.de/?json=get_category_posts&slug=app
我是一名优秀的程序员,十分优秀!