Dynadot

Help needed

Spaceship Spaceship
Watch
Impact
11,347
Code:
function paginate($numresults, $page, $orderby = NULL, $catid = NULL, $search = NULL)
{
	//Generate image path according to calling script
    
    if(substr($_SERVER[REQUEST_URI],-13,-1)=='portfolio.ph'){
        $_navigationimg='./templates/default/images';        
    }else{
        $_navigationimg='../templates/admin/images';
    }

I'm having a problem with my pagination images not displaying. My admin pagination is working (shows images) but my default pagination (doesn't show images). When I look at the code generated by the page, it's showing the admin pagination location on the default pages (which is presumably why it isn't showing the images). The same images are in both locations.

What I understand (rightly or wrongly) is because portfolio.ph doesn't exist, that is why it's defaulting to the admin location for the images. How should I re-write this code so that default images are displayed and admin images are displayed depending upon whether it's a visitor or me logged in as administrator.

Is this even the correct code to be tinkering with?
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Well I don't know the whole situation but if you can just see it in IE it will show a Red Colored "X"

Right click it and select "Image Location"

If you are in Firefox then right click and select "Copy Image Location"

I know there is no image but we have to copy the image path of the location that isn't there and the HTML is referring to... So the image path stuff will be more clearer from both point of view.

Thanks.

---------- Post added at 01:30 PM ---------- Previous post was at 01:30 PM ----------

Or Just do one thing :) fire me a PM with URL and details and lets see what we can do.

If I can sort it out in some mins then I will :)

Thanks.
 
1
•••
I guess you could do it like this

Code:
function paginate($numresults, $page, $orderby = NULL, $catid = NULL, $search = NULL)
{

$current_path = explode('/' , $_SERVER[REQUEST_URI]);
if(strpos($current_path[1], '.php')) {
  $_navigationimg='./templates/default/images'; 
} else {
$_navigationimg='../templates/admin/images';
}

If the current page ends in .php then it'll use the normal path, if it doesn't it (aka it's a folder) it'll use the admin path.

This is just quick and simple if you use other folders for other things it would need to be different.
 
Last edited:
0
•••
Ok. I figured out some stuff. The URL's are not as simple as first thought.

The front-end is either
http://domain.com/portfolio/portfolio.php
or for subsequent pages
http://domain.com/portfolio/portfolio.php?page=2&sort=domain

The back-end is either
http://domain.com/portfolio/admin/admin.php
or for subsequent pages
http://domain.com/portfolio/admin/admin.php?page=2&sort=domain

The number is the page number. Sometimes ever the first page uses the long syntax. The short syntax is usually for the first visit to the page.

Remember I cannot hard code the domain (which I have changed). So what should my if statement look like?
 
Last edited:
0
•••
. How should I re-write this code so that default images are displayed and admin images are displayed depending upon whether it's a visitor or me logged in as administrator.

Do you have access to a variable along the lines of $is_logged_in or $is_admin?
 
0
•••
This is your original code

Code:
function paginate($numresults, $page, $orderby = NULL, $catid = NULL, $search = NULL)
{
	//Generate image path according to calling script
    
    if(substr($_SERVER[REQUEST_URI],-13,-1)=='portfolio.ph'){
        $_navigationimg='./templates/default/images';        
    }else{
        $_navigationimg='../templates/admin/images';
    }

It will be replaced by

Code:
function paginate($numresults, $page, $orderby = NULL, $catid = NULL, $search = NULL)
{
//Generate image path according to calling script
$pageid = $_SERVER["REQUEST_URI"];
$findme   = 'admin';
$pos = strpos($pageid, $findme);
if (!$pos === false)
{
$_navigationimg='../templates/admin/images';
}
else
{
$_navigationimg='./templates/default/images';
}

Thanks.
 
1
•••
That worked great Keral. Than you very much.
 
0
•••
Code:
function paginate($numresults, $page, $orderby = NULL, $catid = NULL, $search = NULL)
{

$current_path = explode('/' , $_SERVER[REQUEST_URI]);
if(strpos($current_path[1], 'admin')) {
$_navigationimg='../templates/admin/images';
} else {
 $_navigationimg='./templates/default/images'; 
}

Would also work, if the folder is "admin" it'll use the admin directory if not it'll use the default.
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back