Pagination Not Displaying - php

I am a front-end designer/code trying to style up pagination for a web app. It is called in one section of the application and called it with the following:
<?php echo $pagination;?>
And I used CSS + the Pagination JS file to style it up.
In another section of the application, which I have just been asked to style, it is called with this:
<?php echo $pages;?>
And looks entirely unstyled. When I replace $pages with $pagination the page control no longer appears. When I run a search for $pages through our repository I see no matches for $pages (not even in the pagination file).
Anyone have any idea why pagination breaks the control?
Thanks!
EDIT: I did a really bad job of explaining this. The problem is that I can find a reference to the variable $paginate in the repository (in paginate.js) and I was able to assign a CSS class to it through that JavaScript file, but I can't find any references to $pages, which I just can't wrap my head around. If I change the variable to something else that I think is defined (such as $paginate) it no longer displays the pagination.
EDIT: Figured it out, it was in the controller in CodeIgniter.

Well, I'm not quite sure if I my answer will help, but as far as I undertood your question
When $pages is called, in the source don't you see the HTML tags that those pages are? Why don't you try not assign smth in javascript but make styles in your CSS according to those html tags that are generated?
for ex.
<div class="smth">
<div class="your_$page_div">
<ul>
<li>text</li>
etc...
In your CSS do smth like div.smth div.your_$page_div ul li {some stile}
so you won't have to replace anything and assign smth in core file.
I hope I correctly understood what you were asking :P Cheers!
I just saw you figured out the problem

Related

How do I manually edit an Omeka theme

I'm building a digital archive using Omeka Classic and I would like to place little flag icons that link to versions of my site in different languages in the header, so I’m trying to figure out how to tinker with the theme’s code (The theme is Minimalist). I don’t have a ton of programming experience, but I think I need to go to /themes/minimalist/common/header.php and add a php echo statement within the <div class="site-title"></div> tag to place my icons within the header section. And that’s as far as I can get on my own.
Questions:
Do I need to define my icons as a variable somewhere and then write an echo statement to the effect of: <?php echo VARIABLE; ?> Php at this level is above my head, but it looks like this is how content is being generated.
Could I add an echo statement in the location suggested above without using a variable or constant? Maybe something like this? <?php echo <a class="lang" href="URL to Arabic language site"><img src="URL to flag image"/></a>; ?> And then I could style the .lang class to push the flags to the bottom right corner of the site-title div.
Just wanted to ask before I start experimenting and break the site.

Magento 1.6CE layered navigation 'reset filter' missing href attribute (JavaScript location?)

I have a problem on my magento layered nav, where the 'reset' function to clear the 'shopping by' filters does not work.
There is nothing showing in the console on click, the page just refeshes.
There is an empty href attribute in the anchor element which I think must be related.
<div class="actions">
<a href>Clear All</a>
</div>
I have looked in the catalog/layer/view.phtml which the template hints indicate is generating the html. There is no reference to the div.actions.
There is however the following script call in the place I would expect this to be found
<script type="text/javascript">decorateDataList('narrow-by-list')</script>
Is someone able to tell me the location of the code this is referencing, and possibly explain what is going on. I'm okay with JavaScript but don't know Prototype- it looks like a call to a function although I would have expected it to end with a semi colon. Really I just need to find the file it references.
If this is unrelated, and I should be looking elsewhere for the the code that generates the link please tell.
Many thanks

Apply a class to a <h1> based on the site url

I'm new to PHP and want to apply a specific class to the title of my page depending on what part of the site the viewer is browsing.
For instance, I want to apply the class "blog" to the if the viewer is at domain.com/blog OR domain.com/blog/post-1 so on and so forth BUT apply the class "pics" if they're viewing domain.com/pics or domain.com/pics/gallery-1 etc etc.
I found something that could be modified to serve my needs using javascript here
but I figured seeing as I'm using PHP already, it'd make more sense to keep this sort of thing server side.
As I say, I'm new to PHP. I've experimented with some regular expressions, but to no avail.
EDIT: Sorry not to be more specific in my first post, I am using wordpress as my CMS - this is my first stackoverflow post, I trust you can forgive me :)
<?php
if (substr($_SERVER['REQUEST_URI'], 0,5)=='/pics') {
$h1class='someclass';
}
The it depends on how you're putting the class in the tag, might be like this
?><h1 class="<?php echo $h1class; ?>">...
Rather than putting a class in based on the page, I would suggest having seperate CSS files for home.css, blog.css, whateverelse.css. Of course, these would be in addition to some sort of default.css or site.css or whatever that would contain the styles used across the site.
You can then build a function/method to create the CSS calls in the HTML header. I usually have a "Page" object that builds the actual HTML page, and a "get_css" method that spits out the CSS calls.
It's hard to get more specific without knowing how you currently build pages.
Here is the solution I ended up crafting. Credit to #m.buettner for pointing me towards explode().
<h1 id="title-text" class="
<?php #returns the category as a class
$url = array();
$url = explode('/', get_permalink());
echo $url[3];
?>
mono in-case-404">
SITE
</h1>

Get css class of div with php

I don't even know if this is possible but hopefully someone will be able to point me in the right direction.
Basically I want to know if there is a way of getting the css class of a div and then displaying content based on that class.
So for example if;
<body class="home">
Then a div would display as follows;
<div><p>This is the Home page</p></div>
Like I said, I don't even know if this is possible but any help would be greatly appreciated.
Thanks
What you're trying to do can be done with Javascript, but if you want to use php only, then try to use php before you provide the "class" parameter. For example, if $_GET['class']=="home" then <div class="<? echo $_GET['class']?>">some text</div>
Perhaps, you can use Javascript, with IDs for example:
<div id="home"></div>
<script>document.getElementById('home').InnerHTML = "this is text for home";</script>
Hope it helps!
See you point, but you goes the wrong way. If you want to put all content in one page differs by some query param, there is no need to do so. You just can hide unneeded blocks with css and show them with js. On the other hand, if this is some sort of server-side utilization, there is definitely no reason to do so too. On the server you can totally control the output, so make separate templates.
Is there a reason not to use PHP instead of reading the class of a div?
#index.html
<html>
<?php include /contentDefinitions.php; ?>
...
<?php $content = home; ?>
...
</html>
#contentDefinitions.php
<?php
if($content = home){
<p>This is the homepage. I am a happy paragraph.</p>
}
?>
**this would be a little more efficient with an array or something,
but at the end of the day the easiest thing would just be to include
home.php, page2.php, page3.php etc. as needed instead of going the
route of variables etc... though having an array would let you edit
all the content within one file.
I'm no master of code and have zero familiarity with Joomla, so this may be absolutely useless to you. :)

Css Html JavaScript - Navigation Highlight current selected Menu

i think this question is very easy but I don't know if i am right.
I am an oldschoool html, php coder.
I want to use this kind of navigation:
http://www.cssportal.com/horizontal-menus/13styles.htm
So far no problem. I got an dynamic php page and i want to use this Menu.
There is no problem without this line in the HTML Part:
<li><span>LINK</span></li>
The Problem is the class. What is the smartest way to detect which link is now current?
I would do it in this way. I would write a php script like this pseudo code:
if acutaldocument == "link1.html" then echo "class='current' ";
But i think this is not the smartest way. Or am I right?
Thanks
There's many options...
You can use session cookies, JavaScript, you can pass an id on the end of the url (eg. ?nav=2) or parse the URL and check against it...
All of them work... all of them have there pros and cons... just depends on how your page is set up...
Give each page's body tag an ID. Say, you give the About page's body tag the id "about". Give IDs for all your navigation <li>s too. Say, you give "about" id to the navigation <li>
In your CSS file, do this:
body#about li#about {
// apply differentiating style here...
}
You can keep doing that for all other pages also. And only when both the body ID and the <li> ID match, the style is applied.

Categories